-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathHelloWorld.java
More file actions
52 lines (36 loc) · 1.45 KB
/
HelloWorld.java
File metadata and controls
52 lines (36 loc) · 1.45 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import org.openqa.selenium.*;
import com.perfectomobile.selenium.*;
import com.perfectomobile.selenium.api.*;
public class MobileTest {
public static void main(String[] args) {
System.out.println("Run started");
// The default empty constructor of MobileDriver should be used when running the code inside Eclipse.
// The user must have the ECLIPSE role in this case.
// Otherwise, use the constructor that receives the host, user and password. E.g.
// MobileDriver driver = new MobileDriver(host, user, password);
MobileDriver driver = new MobileDriver();
try {
// MobileDeviceFindOptions devOp = new MobileDeviceFindOptions();
// devOp.setOS("iOS");
// IMobileDevice device = driver.findDevice(devOp);
IMobileDevice device = driver.getDevice("3152168C4EAA1E2A5DE93CF7B89222720E3A62E0");
device.open();
IMobileWebDriver webDriver = device.getDOMDriver("google.com");
webDriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
webDriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
webdriver.findElement(By.xpath("(//input[@id=\"lst-ib\"])[1]")).sendKeys("Perfecto Mobile");
webdriver.findElement(By.xpath("(//button[@id=\"tsbb\"])[1]")).click();
} catch (Exception e) {
e.printStackTrace();
} finally {
driver.quit();
}
System.out.println("Run ended");
}
private static void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
}
}
}