-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIAutomatorTest.java
More file actions
33 lines (22 loc) · 1.28 KB
/
Copy pathUIAutomatorTest.java
File metadata and controls
33 lines (22 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
public class UIAutomatorTest extends Base {
public static void main(String[] args) throws MalformedURLException {
// TODO Auto-generated method stub
AndroidDriver<AndroidElement> driver = capabilities();
driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS);
//driver.findElementByAndroidUIAutomator("attribute(value)");
//in java you can't write double code into the double code that is why you
//you have to pass special character value for e.g.("text(\"views\")");
driver.findElementByAndroidUIAutomator("text(\"Views\")").click();
System.out.println("Test 1");
//driver.findElementByAndroidUIAutomator("text(\"Animation\")").click();
System.out.println("Test 2");
//validate clickable feature for all options
driver.findElementByAndroidUIAutomator("new UiSelector().property(value)"); //for identify the properties e.g clickable, scrollable, etc by using the concatination new
//UIselector.
System.out.println(driver.findElementByAndroidUIAutomator("new UiSelector().clickable(true)").getSize()); // for knowing the result size how many we have written
}
}