Skip to content

Commit bf9431d

Browse files
committed
Add TakesScreenshot, SessionStorage and LocalStorage testsets
1 parent cee5e6e commit bf9431d

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

java/client/src/org/openqa/selenium/qtwebkit/QtWebKitDriver.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,26 @@
1818

1919
package org.openqa.selenium.qtwebkit;
2020

21+
import org.openqa.selenium.html5.*;
2122
import org.openqa.selenium.Capabilities;
2223
import org.openqa.selenium.OutputType;
2324
import org.openqa.selenium.TakesScreenshot;
2425
import org.openqa.selenium.remote.DriverCommand;
2526
import org.openqa.selenium.remote.RemoteWebDriver;
27+
import org.openqa.selenium.remote.html5.RemoteLocalStorage;
28+
import org.openqa.selenium.remote.html5.RemoteSessionStorage;
2629

2730

28-
public class QtWebKitDriver extends RemoteWebDriver implements TakesScreenshot {
31+
32+
public class QtWebKitDriver extends RemoteWebDriver implements TakesScreenshot, WebStorage {
33+
34+
private RemoteLocalStorage localStorage;
35+
private RemoteSessionStorage sessionStorage;
36+
2937
public QtWebKitDriver(Capabilities capabilities) {
3038
super(QtWebKitDriverService.getCommandExecutor(), capabilities);
39+
localStorage = new RemoteLocalStorage(getExecuteMethod());
40+
sessionStorage = new RemoteSessionStorage(getExecuteMethod());
3141
}
3242

3343

@@ -38,5 +48,14 @@ public <X> X getScreenshotAs(OutputType<X> target) {
3848
return target.convertFromBase64Png(base64);
3949
}
4050

51+
@Override
52+
public LocalStorage getLocalStorage() {
53+
return localStorage;
54+
}
55+
56+
@Override
57+
public SessionStorage getSessionStorage() {
58+
return sessionStorage;
59+
}
4160
}
4261

java/client/test/org/openqa/selenium/testing/drivers/QtWebKitDriverSupplier.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import com.google.common.base.Supplier;
1111
import org.openqa.selenium.Capabilities;
1212
import org.openqa.selenium.WebDriver;
13-
import org.openqa.selenium.qtwebkit.QtWebDriverExecutor;
13+
import org.openqa.selenium.qtwebkit.QtWebKitDriver;
1414
import org.openqa.selenium.remote.DesiredCapabilities;
1515
import org.openqa.selenium.remote.LocalFileDetector;
1616
import org.openqa.selenium.remote.RemoteWebDriver;
@@ -40,21 +40,14 @@ public WebDriver get() {
4040
return null;
4141
}
4242

43-
java.net.URL hostURL;
43+
String remoteIpProperty = "RemoteIP";
44+
String ip = System.getProperty(remoteIpProperty);
45+
if (ip == null)
46+
System.setProperty(remoteIpProperty, "http://localhost:9517");
4447

45-
try {
46-
hostURL = new java.net.URL("http://localhost:9517");
47-
} catch (java.net.MalformedURLException e) {
48-
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
49-
return null;
50-
}
48+
RemoteWebDriver driver = new QtWebKitDriver(desiredCapabilities);
49+
driver.setFileDetector(new LocalFileDetector());
5150

52-
/*RemoteWebDriver driver = new RemoteWebDriver(
53-
hostURL, desiredCapabilities, requiredCapabilities);*/
54-
QtWebDriverExecutor executor = new QtWebDriverExecutor(hostURL);
55-
RemoteWebDriver driver = new RemoteWebDriver(
56-
executor, desiredCapabilities, requiredCapabilities);
57-
driver.setFileDetector(new LocalFileDetector());
5851
return driver;
5952
}
6053
}

0 commit comments

Comments
 (0)