Mobile Safari on Real Device. Almost works :) Help in final steps.

358 views
Skip to first unread message

Matthew Dunn

unread,
Jun 13, 2014, 7:03:54 AM6/13/14
to ios-d...@googlegroups.com
Hi guys,

I've been trying to setup ios-driver to work on a real device for testing on mobile safari etc...

The steps I have done are as follow's
1. Plugin a ios iphone with web inspector turned on.
2. Run IOS-server 
java -jar ios-server-standalone-0.6.6-SNAPSHOT.jar -beta
3. Execute the following code.
                DesiredCapabilities safari = IOSCapabilities.iphone("Safari"); 
        safari.setCapability(IOSCapabilities.SIMULATOR, false);
        safari.setCapability(IOSCapabilities.UUID, "d835ed39ee5a71f551464f86641859df360b1f79"); 
        System.out.println(safari.toString());
        RemoteWebDriver driver = new RemoteWebDriver(new URL("http://10.30.9.48:5555/wd/hub"), safari);
        Thread.sleep(5000);
        driver.get("http://www.crossfitgames.com/");
        System.out.println(driver.getTitle());
        Thread.sleep(1000);
        driver.get("http://www.bbc.com/");
        System.out.println(driver.getTitle());
        Thread.sleep(1000);
        driver.get("http://www.crossfitgames.com/");
        System.out.println(driver.getTitle());
        Thread.sleep(1000);
        driver.get("http://www.bt.com/");
        System.out.println(driver.getTitle());
        Thread.sleep(1000);
        driver.get("http://www.bbc.com/");
        System.out.println(driver.getTitle());
        Thread.sleep(1000);
        driver.get("http://www.crossfitgames.com/");
        System.out.println(driver.getTitle());
        Thread.sleep(1000);
        System.out.println(driver.getTitle());
        driver.quit();



Now this doesn't work and in the log on the server i get the following.

Kitty:target tester$ java -jar ios-server-standalone-0.6.6-SNAPSHOT-20140612-1724.jar -beta > iosserver.log
52:28:743 INFO ApplicationStore.<init>  App archive folder:/Users/tester/Projects/ios-driver/server/target/applications
52:29:168 INFO DeviceStore.onDeviceAdded  new device detected (d835ed39ee5a71f551464f86641859df360b1f79) iPhone 5C GTS
52:29:886 INFO DeviceStore.onDeviceAdded  device iPhone 5C GTS = safari 9537.53
52:30:133 INFO DeviceStore.onDeviceAdded  new device detected (449fd653c6e0dcc5fc4c0f63d2526e3d8c3211b1) Iphone 5
52:30:567 INFO DeviceStore.onDeviceAdded  device Iphone 5 = safari 9537.53
52:30:885 INFO IOSServer.initDriver  
Beta features enabled (enabled by -beta flag): true
Simulator enabled : true
Tests can access the server at http://0.0.0.0:5555/wd/hub
Monitoring '/Users/tester/Projects/ios-driver/server/target/applications' for new applications
Archived apps: /Users/tester/Projects/ios-driver/server/target/applications
Build info: ios-driver 0.6.6-SNAPSHOT (built:20140612-1724,sha:dcba05ab55f3debbc7fb7246c9eeb86f53b83f7b)
Running on: Mac OS X 10.9.2 (x86_64)
Using java: 1.7.0_51
Using Xcode install: /Applications/Xcode.app
Using instruments: version:5.1, build: 55044
Using iOS version 7.1
iOS >= 6.0. Safari and hybrid apps are supported.

Applications :
--------------- 
com.apple.mobilesafari::9537.53
CFBundleName=Safari,CFBundleVersion=8536.25,/Users/tester/.ios-driver/safariCopies/safari-6.1.app
com.apple.mobilesafari::9537.53
CFBundleName=Safari,CFBundleVersion=9537.53,/Users/tester/.ios-driver/safariCopies/safari-7.1.app

2014-06-13 11:52:30.950:INFO::jetty-7.x.y-SNAPSHOT
2014-06-13 11:52:31.024:INFO::Started SelectChann...@0.0.0.0:5555
52:38:359 INFO APPIOSApplication.canRun  The application doesn't have any content files. Localization related features won't be available.
52:38:360 INFO APPIOSApplication.canRun  The application doesn't have any content files. Localization related features won't be available.
52:39:882 WARNING WebKitNotificationListener.onMessage  ReportConnectedApplicationsMessage reported 0 app.
52:44:835 WARNING RemoteIOSWebDriver.start  session created but application size=0
java.lang.NullPointerException
at org.uiautomation.ios.drivers.RemoteIOSWebDriver.get(RemoteIOSWebDriver.java:211)
at org.uiautomation.ios.drivers.IOSDualDriver.start(IOSDualDriver.java:149)
at org.uiautomation.ios.ServerSideSession.start(ServerSideSession.java:242)
at org.uiautomation.ios.command.uiautomation.NewSessionNHandler.safeStart(NewSessionNHandler.java:85)
at org.uiautomation.ios.command.uiautomation.NewSessionNHandler.handle(NewSessionNHandler.java:52)
at org.uiautomation.ios.command.BaseCommandHandler.handleAndRunDecorators(BaseCommandHandler.java:103)
at org.uiautomation.ios.servlet.IOSServlet.getResponse(IOSServlet.java:151)
at org.uiautomation.ios.servlet.IOSServlet.process(IOSServlet.java:82)
at org.uiautomation.ios.servlet.IOSServlet.doPost(IOSServlet.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:533)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:475)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:920)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:403)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:184)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:856)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:47)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
at org.eclipse.jetty.server.Server.handle(Server.java:352)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:596)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1066)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:805)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
at java.lang.Thread.run(Thread.java:744)



However if I do the same steps but with the safari browser open on the device it works fine. Is there a way in code to get it to launch safari? Ideally if would be good to have the safari launched by the ios-driver. Is there a missing step that i am missing?

Your help would be most appreciated.

Thanks,
Matt

Trie...@spiraledge.com

unread,
Jun 27, 2014, 10:56:35 PM6/27/14
to ios-d...@googlegroups.com
Hi Mathew,
Could you please show me how to set "a ios iphone with web inspector"?
I'm trying to research how to do test a web on real iOS device.
I'm able to do this on simulator already but device doesnt work for me.
Please support me via: trie...@spiraledge.com

Matthew Dunn

unread,
Jun 30, 2014, 4:39:33 AM6/30/14
to ios-d...@googlegroups.com
Hi Trieu,

If on the iphone you go to settings > safari> advanced > web inspector 

You can turn it on and off there. :)

Hope that helps.
Message has been deleted

vikas.kri...@gmail.com

unread,
Jul 21, 2014, 8:44:31 AM7/21/14
to ios-d...@googlegroups.com
Hi Matthew,
Were you able to launch the safari through code. Even I'm facing the same issue

Thanks,
Vikas

Matthew Dunn

unread,
Jul 21, 2014, 8:54:57 AM7/21/14
to vikas.kri...@gmail.com, ios-d...@googlegroups.com
You have to leave Safari open and running at the momment. I belive they are working on a way of resolving this so you can launch it but at the momment this is the work around.
--
Matt Dunn
Matthe...@gmail.com

vikas.kri...@gmail.com

unread,
Jul 21, 2014, 10:07:03 AM7/21/14
to ios-d...@googlegroups.com, vikas.kri...@gmail.com
Thanks Matthew. For time being we will do it with safari open :)

Matthew Dunn

unread,
Aug 15, 2014, 6:24:19 AM8/15/14
to ios-d...@googlegroups.com
Looks like they have managed to start safari up now on real devices :) Tried this yesterday with latest code and it now launches Safari :)

vikas.kri...@gmail.com

unread,
Aug 15, 2014, 6:30:36 AM8/15/14
to ios-d...@googlegroups.com
Thanks a lot Mathew for the information :). I will check with the latest jar and let you know. Once again thanks mate.

Thanks and Regards,
Vikas

vikas.kri...@gmail.com

unread,
Aug 18, 2014, 9:11:03 AM8/18/14
to ios-d...@googlegroups.com
Hi Mathew just now i have tried executing my script but i see the safari is not launching and ended with an exception. Could please let me know which jar you are using

Thanks,
Vikas

Shashidhar

unread,
Aug 22, 2014, 12:06:46 AM8/22/14
to ios-d...@googlegroups.com
HI can you please specify what can be done using c#, we cannot include the ios-server in c# language. I am using IOS- server and IOS grid - plugin to run the c# code on real device

vikas.kri...@gmail.com

unread,
Sep 17, 2014, 5:44:32 AM9/17/14
to ios-d...@googlegroups.com
Hi Shashidhar,

I believe there is no .dll file to refer in visual studio. I searched it through but ended up writing code in java.

vikas.kri...@gmail.com

unread,
Sep 17, 2014, 5:45:44 AM9/17/14
to ios-d...@googlegroups.com, vikas.kri...@gmail.com
Hi Mathew,

I'm still not able to launch the safari browser. Could you please let me know how have you done. Thanks in advance.

Regards,
Vikas

psphan...@gmail.com

unread,
Jun 12, 2015, 8:06:30 AM6/12/15
to ios-d...@googlegroups.com
Hi Matt,

I know this is an old post, but i started now working on this safari in real devices. My concern is, am not able to lauch the safari browser by itself. Could you please help me on it.

Phaneendra

Greg Dennis

unread,
Jun 12, 2015, 10:37:07 AM6/12/15
to psphan...@gmail.com, ios-d...@googlegroups.com
In my experience it works on physical devices on iOS7 but not iOS8. If I ever get it working on iOS8, I'll submit a pull request t Francoise with the changes.
Reply all
Reply to author
Forward
0 new messages