NEW 212368
safaridriver can not create safari session on real iPad device
https://bugs.webkit.org/show_bug.cgi?id=212368
Summary safaridriver can not create safari session on real iPad device
mperkh
Reported 2020-05-26 00:13:31 PDT
## The problem - safaridriver very often not able to connect to mobileSafari on real iOS 13 device. - It seems to work as described in https://webkit.org/blog/9395/webdriver-is-coming-to-safari-in-ios-13/ but when trying to run a 2nd test session, safaridriver doesnt seem to be able to connect do mobileSafari on the device. This seems to happen, if the 2nd session is not immediately started after the 1st one - mobileSafari seems to be suspended and safaridriver can not handle this situation. - mobileSafari seems to be in kind of suspended mode after webdriver connection has been closed. Only solution, to make further connects, is manually killing mobileSafari via iOS app switcher. - The issue seems to only exist on iPads and not on iPhones, where mobielSafari stays open after webdriver session has been closed. ## Steps to reproduce - Use a real iPad connected via USB to a Mac with macOS 10.15: 1. Launch safaridriver /Applications/Safari\ Technology\ Preview.app/Contents/MacOS/safaridriver --port 4444 2. curl by another terminal ``` curl -X POST \ http://localhost:4444/session \ -H 'Content-Type: application/json' \ -d '{ "capabilities": { "alwaysMatch": { "browserName": "Safari", "platformName": "iOS" } } }' ``` 3. Then delete this session agin using DEL using the given ID. This works the first time, but repeating this procedure does not open mobileSafari again. ``` curl -X DELETE http://localhost:4444/session/GIVEN_SESSIONID_FROM_STEP_2 ``` 4. Repeate step 2-3. ## Actual response ``` { "value": { "error": "session not created", "message": "Could not create a session: The session timed out while connecting to a Safari instance.", "stacktrace": "" } } ``` ## Environment - iOS version: iOS13.5 - host machine version: 10.15.4 - safaridriver version: Included with Safari Technology Preview (Release 106, 15610.1.12.2) ## Note - It is not possible to get around this issue. Only solution is to manually kill mobileSafari via App Switcher.
Attachments
Blaze Burg
Comment 1 2020-05-26 11:29:03 PDT
Thank you for your bug report. Alas, this is a safaridriver/Safari bug, is not a WebKit bug, so I'd appreciate it if you could re-file the bug at https://feedbackassistant.apple.com/. Some tips for the second bug report: - Please include a host sysdiagnose taken after reproducing the issue (`sudo sysdiagnose` on command line) - Please include a device sysdiagnose taken after reproducing the issue (press volume buttons + lock buttons together. Or file a bug using Feedback Assistant app which will capture/upload for you) - Please pass --diagnose to safaridriver or set `defaults write com.apple.WebDriver DiagnosticsEnabled 1`. Thanks again for the report! -Brian
Shi Ling
Comment 2 2020-05-31 07:03:18 PDT
I ran into the same problem trying to run safaridriver with a real iPad device. But I managed to get it to work after reading the manual from `man safaridriver` and finding out that it's necessary to set `safari:deviceType` as `ipad` as one of the capabilities when starting a session. Try this: ``` curl -X POST \ http://localhost:4444/session \ -H 'Content-Type: application/json' \ -d '{ "capabilities": { "alwaysMatch": { "safari:deviceType": "iPad" "browserName": "Safari", "platformName": "iOS" } } }' ``` You will also need to enable "Safari > Advanced > Web Inspector" on the iPad. Should have been mentioned in the https://webkit.org/blog/9395/webdriver-is-coming-to-safari-in-ios-13/ blogpost though.
Blaze Burg
Comment 3 2020-06-01 11:38:13 PDT
(In reply to Shi Ling from comment #2) > I ran into the same problem trying to run safaridriver with a real iPad > device. > > But I managed to get it to work after reading the manual from `man > safaridriver` and finding out that it's necessary to set `safari:deviceType` > as `ipad` as one of the capabilities when starting a session. > [...] mperkh's bug description matches an issue that we are tracking internally. The current understanding is that it's a bug in how safaridriver launches/connects to MobileSafari. Being more specific about iPad/iPhone capabilities is very likely not related, but thanks for sharing your experience. Also a reminder to file safaridriver bugs at https://feedbackassistant.apple.com/. Feel free to email me with your FB id if you'd like confirmation that I've gotten the bug report.
Shi Ling
Comment 4 2020-06-01 18:48:12 PDT
(In reply to Brian Burg from comment #3) > (In reply to Shi Ling from comment #2) > > I ran into the same problem trying to run safaridriver with a real iPad > > device. > > > > But I managed to get it to work after reading the manual from `man > > safaridriver` and finding out that it's necessary to set `safari:deviceType` > > as `ipad` as one of the capabilities when starting a session. > > [...] > > mperkh's bug description matches an issue that we are tracking internally. > The current understanding is that it's a bug in how safaridriver > launches/connects to MobileSafari. Being more specific about iPad/iPhone > capabilities is very likely not related, but thanks for sharing your > experience. > > Also a reminder to file safaridriver bugs at > https://feedbackassistant.apple.com/. Feel free to email me with your FB id > if you'd like confirmation that I've gotten the bug report. Hm... looks like you're right. I removed "safari:deviceType" from capabilities and was able to start a test session on the iPad. Seems like it was a fluke when it worked after I tried adding "safari:deviceType". Perhaps whatever was preventing the sessions from starting went away when I gone off for dinner. (=_=)
Note You need to log in before you can comment on or make changes to this bug.