Skip to content

Commit

Permalink
Adding touch screen funtionality to ChromeDriver (#2694)
Browse files Browse the repository at this point in the history
* Adding touch screen funtionality to ChromeDriver
  • Loading branch information
kdaimiel authored and lukeis committed Oct 3, 2016
1 parent 7e2cca5 commit 87f0371
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion java/client/src/org/openqa/selenium/chrome/ChromeDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
import org.openqa.selenium.html5.LocationContext;
import org.openqa.selenium.html5.SessionStorage;
import org.openqa.selenium.html5.WebStorage;
import org.openqa.selenium.interactions.HasTouchScreen;
import org.openqa.selenium.interactions.TouchScreen;
import org.openqa.selenium.remote.FileDetector;
import org.openqa.selenium.remote.RemoteTouchScreen;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.html5.RemoteLocationContext;
import org.openqa.selenium.remote.html5.RemoteWebStorage;
Expand Down Expand Up @@ -101,10 +104,11 @@
* @see ChromeDriverService#createDefaultService
*/
public class ChromeDriver extends RemoteWebDriver
implements LocationContext, WebStorage {
implements LocationContext, WebStorage, HasTouchScreen {

private RemoteLocationContext locationContext;
private RemoteWebStorage webStorage;
private TouchScreen touchScreen;

/**
* Creates a new ChromeDriver using the {@link ChromeDriverService#createDefaultService default}
Expand Down Expand Up @@ -170,6 +174,7 @@ public ChromeDriver(ChromeDriverService service, Capabilities capabilities) {
super(new ChromeDriverCommandExecutor(service), capabilities);
locationContext = new RemoteLocationContext(getExecuteMethod());
webStorage = new RemoteWebStorage(getExecuteMethod());
touchScreen = new RemoteTouchScreen(getExecuteMethod());
}

@Override
Expand Down Expand Up @@ -199,6 +204,11 @@ public void setLocation(Location location) {
locationContext.setLocation(location);
}

@Override
public TouchScreen getTouch() {
return touchScreen;
}

/**
* Launches Chrome app specified by id.
*
Expand All @@ -207,4 +217,5 @@ public void setLocation(Location location) {
public void launchApp(String id) {
execute(ChromeDriverCommand.LAUNCH_APP, ImmutableMap.of("id", id));
}

}

0 comments on commit 87f0371

Please sign in to comment.