Skip to content

Instantly share code, notes, and snippets.

View freynaud's full-sized avatar

François Reynaud freynaud

  • Element34 Solutions GmbH
  • Altendorf, Switzerland
View GitHub Profile
@freynaud
freynaud / time
Created November 29, 2012 20:30
895 ms.POST /session/5f0e93ab-fae3-442d-af35-ad45398d41f6/element
1184 ms.GET /session/5f0e93ab-fae3-442d-af35-ad45398d41f6/element/4/attribute/name
1061 ms.POST /session/5f0e93ab-fae3-442d-af35-ad45398d41f6/element
1067 ms.GET /session/5f0e93ab-fae3-442d-af35-ad45398d41f6/element/5/attribute/name
1068 ms.POST /session/5f0e93ab-fae3-442d-af35-ad45398d41f6/element
1074 ms.GET /session/5f0e93ab-fae3-442d-af35-ad45398d41f6/element/6/attribute/name
1064 ms.POST /session/5f0e93ab-fae3-442d-af35-ad45398d41f6/element
1078 ms.GET /session/5f0e93ab-fae3-442d-af35-ad45398d41f6/element/7/attribute/name
1061 ms.POST /session/5f0e93ab-fae3-442d-af35-ad45398d41f6/element
1082 ms.GET /session/5f0e93ab-fae3-442d-af35-ad45398d41f6/element/8/attribute/name
IOSCapabilities safari = IOSCapabilities.ipad("Safari");
safari.setCapability(IOSCapabilities.TIME_HACK, false);
driver = new RemoteUIADriver(url, safari);
Criteria urlAddressBar =
new AndCriteria(new TypeCriteria(UIAElement.class), new ValueCriteria("Go to this address"));
// using native selector and event.
public RemoteObject findElementById(RemoteObject element,String id) throws Exception {
JSONObject cmd = new JSONObject();
cmd.put("method", "Runtime.callFunctionOn");
JSONArray args = new JSONArray();
args.put(new JSONObject().put("value", id));
if (element == null){
Node document = cache.getCurrentDocument();
{
"id": 7,
"result": {
"result": {
"className": "HTMLFormElement",
"description": "HTMLFormElement",
"objectId": "{\"injectedScriptId\":149,\"id\":2}",
"subtype": "node",
"type": "object"
},
{
"id": 3,
"result": {
"result": {
"subtype": "null",
"type": "object",
"value": null
},
"wasThrown": false
}
public static void main(String[] args) throws Exception {
WebInspector inspector = new WebInspector();
String ref = inspector.findSearchButton();
inspector.callFunctionOn(ref);
}
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")
@freynaud
freynaud / xml
Created November 5, 2012 23:03
<?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>
@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);
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),