how to take a screenshot of the entire webpage? - selenium

I am very new to all the technologies so can any one suggest what tool can I use to take screenshot of entire web page along with the URL.
These screenshots would be taken every quarterly, and after a quarter it will be compared with the last quarter's screenshot. It will be compared on the basis of major changes made on web page
I have to do this for 100's of domains.
Please suggest
1.Tool to take screen shot
2.How to compare.
Any suggestion appreciated.

Selenium & imacro can help u taking the browser screenshot

There is no such tool in existence which can perform above specified tasks.
You can easily find tools for capturing screenshots, but you will be not able to view changes done after a specified time. You need to develop a crawler to perform this task. You can pick PHP or .net as technology to handle this task.
In case, you have any query, you can let us know anytime.
Thank You

You can use below selenium code
File file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
Where driver is Webdriver object (e.g. WebDriver driver=new FirefoxDriver();)

Here is an example of iMacros solution.
http://wiki.imacros.net/SCREENSHOT
URL GOTO=http://www.iopus.com/imacros/home/v9/home.asp
SCREENSHOT TYPE=Page FOLDER=* FILE=*
SCREENSHOT TYPE=Browser FOLDER=* FILE=*

You can take screenshot using selenium web driver code , See below :
http://www.ontestautomation.com/how-to-create-screenshots-in-your-selenium-webdriver-tests/

Related

How to write gherkin scenario directly on Xray test case creation page

How do I get the below options like test details (to add BDD scenario) when creating test cases?
enter image description here
On my one it just looks like this. I have imported the 6 test type from Xray into my JIRA project. Is there more configuration that needs to be done? Once created, I can click on the test case and insert the scenario there, but surely I should be able to do this whilst creating in the first place. I can't find anything on this new layout online.
enter image description here
If you are using Xray on Jira server/Data Center, then you can fill out the Cucumber Scenario details right away as mentioned here.
If you're using Jira Cloud then you can't do this due to current limitations on Jira/Atlassian side; in this case, you have to create the Test first and then edit the scenario/scenario outline from the Test issue screen.

How to check in jmeter if entered fields remain same in the first page after navigating back from nth page

I want to test a page.Where i want to fill up the fields like first name last name etc.and after going two pages further if i come back to the original page by using back navigation ,data entered for first name and last name remains the same.or it is filled up.
In jmeter i want to check the same if data entered for the fields remain same if i navigate back .
How can i achieve this.
I tried gving url directly in the path its not happening since it is not the way.
please help me since i'm new to jmeter.
You need to understand 2 things. How JMeter works and how your application works.
JMeter only captures data that is communicated to server. It does not matter how data is entered from UI. It does not check if data retains in the fields or not. It only records the request that is sent by your application to server-side.
So, if you understand above, you also need to understand how your application sends data to server. Does it sends the request as you move from first page to second. Or does it send (Submit) data on final page.
Either way, JMeter is not a tool to test if your form fields are retaining data in them as you navigate between pages. As mentioned earlier it only monitors data requests/responses.
Selenium seems a better option for your test requirement.
Please read the apache documentation carefully:
JMeter is not a browser. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever viewed at a time).
First, you have to understand how JMeter works!!! To do the Functional Testing, Selenium would be a good choice.
Thanks

TestNG reporting

I want to Email my TestNG report to other users as well but when they are clicking on the screenshot link. They are not able to see the screenshot as it is stored in my local machine.
String SaveandReturn = ScreenShot.takeScreenShot("SaveAndReturnverification");
Reporter.log("<a href=\"" + SaveandReturn + "\"><p align=\"left\"> Add Sub Service in LFA Services screenshot at " + new Date()+ "</p>");
}
How can I attach the screenshot so that other people can also view the report.
If you are able to implement the following it would be quite useful if you have a lot of people who need to see the results of the tests at a given time, its what I have implemented in my enviornment.
I have created a web server using XAMPP. I then created a web page which has links to all the TestNG reports.
Might not suit your environment but its a good solution if it does.
I would suggest you to go for Extentreports which has good UI when compared to TestNG. it is an extended version of testNG reporting framework.
It also suits your requirement of sending the screenshots by keeping at local if you have hosted in your local machine using MongoDB.

Excluding Selenium-server URL in JMeter Proxy Server

I'm currently trying to get JMeter to record the steps my selenium tests so I can perform load testing with the same tests. The steps are recorded fine but my problem is that its also recording the steps performed in the "selenium-server" window (i.e. the extra windows that pop up when selenium runs).
I believe if I add something like *selenium-server* to the "URL Patterns to Exclude" List then it will ignore all these steps but they keep recording for every pattern I've tried.
Can someone please tell me the pattern which will lead to these steps getting ignore?
An example url is: /selenium-server/driver/?retry=true.
Thanks.
Try adding the following to 'URL Patterns to Exclude'
^/selenium-server/.*
If you're trying to use your Selenium tests to generate load, you might also want to look at BrowserMob. It's a company I started that runs actual Selenium browsers en masse in the cloud.
You could try to add the following to 'URL Patterns to Exclude'
.*/selenium-server/.*

Is any way to get captcha value and store it in a variable?

I am Using Selenium RC in C# My application has 3 Captha image in Different registration pages. i have a Huge script i will run it on night hours(when i am off). Hence i feel it will be better if i can capture the last displaying captcha image value and store it in to a variable so that i can input on the relevant field. Is it Possible ?
A Captcha cannot be automated that easily. That is why they were invented!!
Alas... You can use code hackers and Image Recognition patterns and scripts. It is called OCR. http://en.wikipedia.org/wiki/Optical_character_recognition
I will not write more about this as i wont encourage others for hacking ideas. But... First: Google is your friend. Second: In my testing environment we used a captcha with a static value. And then before it went live we removed set it again for the algorithm.
Gergely.
Have a hidden field (with a non-obvious name) that contains a strongly encrypted copy of the text used in the captcha then on your selenium test system decode it using the private key?
For testing purposes you will need to send the captcha value in a machine readable manner, by sending it as an additional field. You would then need to remove the field after the tests are done.
Make use of the 'input' tag with type 'hidden' in-order to handle Captcha.
JavascriptExecutor js = (JavascriptExecutor) driver;
//Set the captcha values using setAttribute
js.executeScript("document.getElementsByName('xxxx')[0].setAttribute('value', 'xxxx')");
driver.findElement(By.name("xxxx")).sendKeys("xxxx");