selenium interview questions 2021 code example
Example 1: selenium interview questions 2019
String setPROXY = "10.0.0.10:8080";
org.openqa.selenium.Proxy allowProxy = new.org.openqa.selenium.Proxy();
allowProxy.setHTTPProxy(setPROXY)
.setFtpProxy(setPROXY)
.setSslProxy(setPROXY);
DesiredCapabilities allowCap = new DesiredCapabilities();
allowCap.setCapability(CapabilityType.PROXY, allowProxy);
WebDriver driver = new FirefoxDriver(allowCap);
Example 2: selenium interview questions 2019
Import org.apache.commons.io.FileUtils;
WebDriver ins = new ChromeDriver();
ins.get("http://www.google.com/");
File screen = ((TakesScreenshot)ins).getScreenshotAs(OutputType.FILE);
// Now you can do whatever you need to do with it, for example copy somewhere
FileUtils.copyFile(screen, new File("c:\tmp\myscreen.png"));