File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
src/main/java/io/appium/java_client Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1919
2020import com .google .common .collect .ImmutableMap ;
2121import org .openqa .selenium .By ;
22+ import org .openqa .selenium .Dimension ;
23+ import org .openqa .selenium .Point ;
2224import org .openqa .selenium .WebElement ;
2325import org .openqa .selenium .remote .*;
2426
@@ -68,6 +70,12 @@ public void setValue(String value) {
6870 execute (MobileCommand .SET_VALUE , builder .build ());
6971 }
7072
73+ public Point getCenter () {
74+ Point upperLeft = this .getLocation ();
75+ Dimension dimensions = this .getSize ();
76+ return new Point (upperLeft .getX () + dimensions .getWidth ()/2 , upperLeft .getY () + dimensions .getHeight ()/2 );
77+ }
78+
7179 protected Response execute (String command , Map <String , ?> parameters ) {
7280 return parent .execute (command , parameters );
7381 }
You can’t perform that action at this time.
0 commit comments