-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathgetDOM.java
More file actions
55 lines (37 loc) · 1.39 KB
/
getDOM.java
File metadata and controls
55 lines (37 loc) · 1.39 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
53
54
55
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import com.perfectomobile.selenium.MobileDriver;
import com.perfectomobile.selenium.api.IMobileDevice;
import com.perfectomobile.selenium.api.IMobileWebDriver;
public class getDom {
public static void main(String[] args) {
MobileDriver connector = new MobileDriver(Constants.PM_CLOUD,Constants.PM_USER,Constants.PM_PASSWORD);
System.out.println("Script started");
try {
IMobileDevice device = connector.getDevice(Constants.DEVICE);
device.open();
WebDriver webDriver = device.getDOMDriver ("www.linkedin.com");
WebDriver visualDriver = device.getVisualDriver();
webDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
webDriver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
visualDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
visualDriver.findElement(By.linkText("Your Profile "));
String source = ((IMobileWebDriver)webDriver).getProperty("innerHTML");
System.out.println(source);
// write your code here
} catch (Exception e) {
e.printStackTrace();
// onError(connector.getDevice(Constants.DEVICE););
} finally {
connector.quit();
}
System.out.println("Script ended");
}
private static void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
}
}
}