In this section we will have a look at how we can go about saving a file to disk. This is the most common thing that people do when saving screenshots. One thing to note is that if you are using RemoteWebDriver, this will save the file on the same machine as the Selenium Server.
Open up Intellij and create a new Java test class.
We will now add a new line for taking a screenshot:driver.get(http://www.wisdomjobs.com); File savedImage = ((Screenshot)driver).getScreenshotAs(file);
If you set a breakpoint on the previous line, you will be able to see what the string looks like.
What just happened?
We have just seen what is probably going to be the most common way to save screenshots when we take them. When we take the screenshot, the image is saved to disk and we are returned the file object that has access to that image.
If you would like to move the file when it is created, you can use the following code snippet:
Selenium Related Interview Questions
|SILK TEST Interview Questions||QTP Interview Questions|
|JMeter Interview Questions||Automation Testing Interview Questions|
|Software testing Interview Questions||JUnit Interview Questions|
|TestNG Interview Questions||SAP Testing Interview Questions|
|Selenium WebDriver Interview Questions||Selenium IDE Interview Questions|
|QUnit Testing Interview Questions||Performance Testing Interview Questions|
|Hadoop Testing Interview Questions|
Getting Started With Selenium Ide
Overview Of Selenium Webdriver
Working With Webdriver
Getting Started With Selenium Grid
Advanced User Interactions
Working With Html5
Migrating From Remote Control To Webdriver
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.