This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void registerIOS(String nodehost, int port) throws JSONException, Exception { | |
RegistrationRequest node = new RegistrationRequest(); | |
HttpClient client = new DefaultHttpClient(); | |
String url = "http://" + nodehost + ":" + port + "/wd/hub/status"; | |
BasicHttpRequest r = new BasicHttpRequest("GET", url); | |
HttpResponse response = client.execute(new HttpHost(nodehost, port), r); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Demo { | |
private final String hub = "http://localhost:4444/wd/hub"; | |
@Test(invocationCount = 15, threadPoolSize = 2) | |
public void testIOSApp() { | |
UIADriver driver = new RemoteUIADriver(hub, IOSCapabilities.iphone("UICatalog")); | |
try { | |
Criteria c1 = new TypeCriteria(UIATableCell.class); | |
Criteria c2 = new NameCriteria("Buttons, Various uses of UIButton"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IOSCapabilities c = IOSCapabilities.iphone("InternationalMountains", "1.1"); | |
c.setLanguage("fr"); | |
... | |
NameCriteria criteria = new NameCriteria("sentenceFormat", L10NStrategy.serverL10N); | |
UIAElement text = driver.findElement(criteria); | |
String actual = text.getName(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var target = UIATarget.localTarget(); | |
target.frontMostApp().mainWindow().tableViews()["Empty list"] | |
.cells()["Buttons, Various uses of UIButton"].tap(); | |
target.frontMostApp().mainWindow().tableViews()["Empty list"] | |
.cells()["Background Image"].buttons()["Gray"].tap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum WebDriverLikeCommand { | |
NEW_SESSION("POST","/session",String.class), | |
GET_SESSION("GET", "/session/:sessionId",JSONObject.class), | |
DELETE_SESSION("DELETE","/session/:sessionId",null), | |
SESSIONS("GET","/sessions",JSONArray.class), | |
SCREENSHOT("GET","/session/:sessionId/screenshot",Void.class), | |
ELEMENT("POST" , "/session/:sessionId/element/:id/element",UIAElement.class), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@DataProvider(name = "ipad") | |
public Object[][] getLanguages() { | |
return new Object[][] { {"en"}, {"fr"}, {"de"}}; | |
} | |
@Test(dataProvider = "ipad") | |
public void testIOSAppIPAD(String language) { | |
IOSCapabilities cap = IOSCapabilities.ipad("eBay"); | |
cap.setLanguage(language); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>__argument</key> | |
<dict> | |
<key>WIRApplicationIdentifierKey</key> | |
<string>com.apple.mobilesafari</string> | |
<key>WIRConnectionIdentifierKey</key> | |
<string>95DF95FF-C8AF-4CF2-94E3-E940A7F03DA9</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws IOException, InterruptedException, JSONException { | |
WebInspector inspector = new WebInspector(); | |
JSONObject cmd = new JSONObject(); | |
cmd.put("id", 1); | |
cmd.put("method", "Runtime.evaluate"); | |
cmd.put( | |
"params", | |
new JSONObject().put("expression", "alert2('test');") | |
.put("objectGroup", "console") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws Exception { | |
WebInspector inspector = new WebInspector(); | |
String ref = inspector.findSearchButton(); | |
inspector.callFunctionOn(ref); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": 3, | |
"result": { | |
"result": { | |
"subtype": "null", | |
"type": "object", | |
"value": null | |
}, | |
"wasThrown": false | |
} |