Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use weaker interface HasIdentity instead of class RemoteWebElement #432

Merged
merged 1 commit into from
Jul 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/main/java/io/appium/java_client/TouchAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.google.common.collect.ImmutableMap;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebElement;
import org.openqa.selenium.internal.HasIdentity;


/**
Expand Down Expand Up @@ -50,7 +50,7 @@ public TouchAction(MobileDriver driver) {
* @return this TouchAction, for chaining.
*/
public TouchAction press(WebElement el) {
ActionParameter action = new ActionParameter("press", (RemoteWebElement) el);
ActionParameter action = new ActionParameter("press", (HasIdentity) el);
parameterBuilder.add(action);
return this;
}
Expand Down Expand Up @@ -79,7 +79,7 @@ public TouchAction press(int x, int y) {
* @return this TouchAction, for chaining.
*/
public TouchAction press(WebElement el, int x, int y) {
ActionParameter action = new ActionParameter("press", (RemoteWebElement) el);
ActionParameter action = new ActionParameter("press", (HasIdentity) el);
action.addParameter("x", x);
action.addParameter("y", y);
parameterBuilder.add(action);
Expand All @@ -104,7 +104,7 @@ public TouchAction release() {
* @return this TouchAction, for chaining.
*/
public TouchAction moveTo(WebElement el) {
ActionParameter action = new ActionParameter("moveTo", (RemoteWebElement) el);
ActionParameter action = new ActionParameter("moveTo", (HasIdentity) el);
parameterBuilder.add(action);
return this;
}
Expand Down Expand Up @@ -135,7 +135,7 @@ public TouchAction moveTo(int x, int y) {
* @return this TouchAction, for chaining.
*/
public TouchAction moveTo(WebElement el, int x, int y) {
ActionParameter action = new ActionParameter("moveTo", (RemoteWebElement) el);
ActionParameter action = new ActionParameter("moveTo", (HasIdentity) el);
action.addParameter("x", x);
action.addParameter("y", y);
parameterBuilder.add(action);
Expand All @@ -149,7 +149,7 @@ public TouchAction moveTo(WebElement el, int x, int y) {
* @return this TouchAction, for chaining.
*/
public TouchAction tap(WebElement el) {
ActionParameter action = new ActionParameter("tap", (RemoteWebElement) el);
ActionParameter action = new ActionParameter("tap", (HasIdentity) el);
parameterBuilder.add(action);
return this;
}
Expand Down Expand Up @@ -178,7 +178,7 @@ public TouchAction tap(int x, int y) {
* @return this TouchAction, for chaining.
*/
public TouchAction tap(WebElement el, int x, int y) {
ActionParameter action = new ActionParameter("tap", (RemoteWebElement) el);
ActionParameter action = new ActionParameter("tap", (HasIdentity) el);
action.addParameter("x", x);
action.addParameter("y", y);
parameterBuilder.add(action);
Expand Down Expand Up @@ -216,7 +216,7 @@ public TouchAction waitAction(int ms) {
* @return this TouchAction, for chaining.
*/
public TouchAction longPress(WebElement el) {
ActionParameter action = new ActionParameter("longPress", (RemoteWebElement) el);
ActionParameter action = new ActionParameter("longPress", (HasIdentity) el);
parameterBuilder.add(action);
return this;
}
Expand All @@ -229,7 +229,7 @@ public TouchAction longPress(WebElement el) {
* @return this TouchAction, for chaining.
*/
public TouchAction longPress(WebElement el, int duration) {
ActionParameter action = new ActionParameter("longPress", (RemoteWebElement) el);
ActionParameter action = new ActionParameter("longPress", (HasIdentity) el);
action.addParameter("duration", duration);
parameterBuilder.add(action);
return this;
Expand Down Expand Up @@ -279,7 +279,7 @@ public TouchAction longPress(int x, int y, int duration) {
* @return this TouchAction, for chaining.
*/
public TouchAction longPress(WebElement el, int x, int y) {
ActionParameter action = new ActionParameter("longPress", (RemoteWebElement) el);
ActionParameter action = new ActionParameter("longPress", (HasIdentity) el);
action.addParameter("x", x);
action.addParameter("y", y);
parameterBuilder.add(action);
Expand All @@ -297,7 +297,7 @@ public TouchAction longPress(WebElement el, int x, int y) {
* @return this TouchAction, for chaining.
*/
public TouchAction longPress(WebElement el, int x, int y, int duration) {
ActionParameter action = new ActionParameter("longPress", (RemoteWebElement) el);
ActionParameter action = new ActionParameter("longPress", (HasIdentity) el);
action.addParameter("x", x);
action.addParameter("y", y);
action.addParameter("duration", duration);
Expand Down Expand Up @@ -355,7 +355,7 @@ public ActionParameter(String actionName) {
optionsBuilder = ImmutableMap.builder();
}

public ActionParameter(String actionName, RemoteWebElement el) {
public ActionParameter(String actionName, HasIdentity el) {
this.actionName = actionName;
optionsBuilder = ImmutableMap.builder();
addParameter("element", el.getId());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.appium.java_client.pagefactory_tests.widgets.ios.simple;

import io.appium.java_client.TouchableElement;
import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.pagefactory.iOSFindBy;
import io.appium.java_client.pagefactory_tests.widgets.Movie;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebElement;

import java.util.List;

Expand All @@ -25,10 +25,10 @@ protected IOSMovie(WebElement element) {
}

@Override public Object getPoster() {
return ((RemoteWebElement) getWrappedElement()).getSize();
return getWrappedElement().getSize();
}

@Override public void goToReview() {
((IOSElement) getWrappedElement()).tap(1, 1500);
((TouchableElement) getWrappedElement()).tap(1, 1500);
}
}