That would be great having option for server like --ios-webkit-debug-proxy -udid port
, etc...
Are you planning to do something like that?
Thank you.
created
Nov '14
last reply
Jul '16
- 19
replies
- 9.2k
views
- 5
users
- 4
likes
- 2
links
That would be great having option for server like --ios-webkit-debug-proxy -udid port
, etc...
Are you planning to do something like that?
Thank you.
Yes. I am doing that on Ruby:
`pkill -f ios-webkit-debug-proxy-launcher ios_webkit_debug_proxy`
`nohup node ~/appium/bin/ios-webkit-debug-proxy-launcher.js -c #{$device_udid}:27753 > /dev/null 2>&1 &`
You can do the same thing on any language. I restart webkit server before creating driver, to make sure server is not down, even though server is quite stable, sometimes it crashes randomly, but very seldom.
Hi Mayuresh_Shirodkar,
I am unable to starting iOS webkit debug proxy server and get iPhone information. Could you please tell me, how to start iOS webkit debug proxy server from terminal using java code and how to get the iOS device information from terminal using java code. This is priority work for me.
Thanks in advance.
Why exactly you are not able to start proxy server? What kind of problem or error do you have? What iPhone information do you want to get?
In Ruby it's easy to execute shell commands using backsticks (`). Essentially that's basic shell script which you can be executed from Java as well:
String deviceId = "****";
Runtime.getRuntime().exec(new String[]{
"pkill -f ios-webkit-debug-proxy-launcher ios_webkit_debug_proxy",
";",
"nohup node ~/appium/bin/ios-webkit-debug-proxy-launcher.js -c " + deviceId + ":27753 > /dev/null 2>&1 &"
});
Hi kirill,
Thanks for reply. Actually I am able to run appium server and adb devices command on terminal using java code in mac , but I really don't how to run command with spaces(Eg. ios-deploy -c) on terminal using java code.
Actually I am trying to get list of iPhone devices which are connected to mac machine using java code after that I am sending UDID, device name and device version of iPhone device to capabilities, but I am unable to get the iPhone data. please find the below java code.
Code 1: The below code is nothing displaying in console.
String[] str = {"/bin/bash", "-c", "ios-deploy -c"};
Process p = Runtime.getRuntime().exec(str);
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
String allLine = "";
while((line=r.readLine()) != null)
{
System.out.println(line);
}
Code 2: The below code is displaying IPhone information + Unnecessary data.
String[] str = {"/bin/bash", "-c", "system_profiler", "SPHardwareDataType","| sed -n -E -e '/(iPhone|iPad)/,/Serial/s/ *Serial Number: *(.+)/\1/p'" };
Process p = Runtime.getRuntime().exec(str);
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
String allLine = "";
while((line=r.readLine()) != null)
{
System.out.println(line);
}
ios-webkit-debug-proxy Server:
I am getting below Exception when I trying to run ios-webkit-debug-proxy Server using below java code:
String deviceId = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
Process p = Runtime.getRuntime().exec(new String[]{
"pkill -f ios-webkit-debug-proxy-launcher ios_webkit_debug_proxy",
";",
"nohup node ~/appium/bin/ios-webkit-debug-proxy-launcher.js -c " + deviceId + ":27753 > /dev/null 2>&1 &"
});
java.io.IOException: Cannot run program "pkill -f ios-webkit-debug-proxy-launcher ios_webkit_debug_proxy": error=2, No such file or directory
Hi kirill,
Could you please tell me, how to start Appium Server and iOS webkit debug proxy server programmatically using java code. This is priority work for me. how to fire the below commands on mac Terminal using java code.
Appium Server:
Directory : cd /Users/caaminf/appium/lib/server
Commande: node main.js -u
iOS webkit debug proxy:
Directory : cd /usr/local/bin/
Command: ios_webkit_debug_proxy -c :27753 -d
Currently I am trying the below ways, but not displaying any thing in java console.
Appium Server :
String[] cmd = { "/bin/sh", "-c", "cd /Users/caaminf/appium/lib/server; node main.js -U d2cd2a957b336b7a73cab93a1aefda6c5a1a" };
Process p = Runtime.getRuntime().exec(cmd);
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
String allLine = "";
int i = 1;
while((line=r.readLine()) != null)
{
System.out.println(line);
i++;
}
iOS webkit debug proxy:
String[] cmd = { "/bin/sh", "-c", "cd cd /usr/local/bin; ios_webkit_debug_proxy -c d2cd2a957b336b7a73cab93a1ae429efa1a:27753 -d" };
Process p = Runtime.getRuntime().exec(cmd);
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
String allLine = "";
int i = 1;
while((line=r.readLine()) != null)
{
System.out.println(line);
i++;
}
Thanks in advance.