Use weaker interface HasIdentity instead of class RemoteWebElement by asolntsev · Pull Request #432 · appium/java-client

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