Imagine that you want to take a screenshot on Selenium Grid. When you take the screenshot, you will not want it to be saved to the hard drive of the Selenium Grid node.
You will want it to be moved back to where your tests are, especially if you are using it with a Continuous Integration Box.
Open up Intellij and create a new Java test class.
We will now add a new line for taking a screenshot:driver.get(http://book.theautomatedtester.co.uk); String screenshotBase64 = ((Screenshot)driver).getScreenshotAs(base64);
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 managed to take a screenshot and have it returned as a base64 string. This will allow us to take a screenshot on a remote machine and then transport the resultant image back to where the test is being run from.
Saving the screenshot to bytes
Now that we have had a look at capturing screenshots to base64 strings, let's have a look at capturing them as bytes. Having them as bytes means that we can transform them into a number of different things as we see fit.
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.