Selenium的IE Driver實作Created by Wang, Jerry, last modified on Sep 09, 2013
Created by Wang, Jerry, last modified on Sep 09, 2013
public class InternetExplorerDriver extends RemoteWebDriver implements TakesScreenshot {
public InternetExplorerDriver(InternetExplorerDriverService service, Capabilities capabilities) {
assertOnWindows();
setCommandExecutor(new DriverCommandExecutor(service));
startSession(capabilities);
}
public <X> X getScreenshotAs(OutputType<X> target) {
// Get the screenshot as base64.
String base64 = execute(DriverCommand.SCREENSHOT).getValue().toString();
// ... and convert it.
return target.convertFromBase64Png(base64);
}
private void setupService(int port) {
try {
InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()
.usingPort(port).build();
setCommandExecutor(new DriverCommandExecutor(service));