google / ios-webkit-debug-proxy

A DevTools proxy (Chrome Remote Debugging Protocol) for iOS devices (Safari Remote Web Inspector).
BSD 3-Clause "New" or "Revised" License
5.94k stars 465 forks source link

iOS real device unable to see web views using newest versions of ios-webkit-debug-proxy, iOS, Xcode and Appium #229

Closed srigney closed 7 years ago

srigney commented 7 years ago

The problem

I recently received a new Mac and now the iOS automation can no longer see web views on the iPhone.

Environment

Details

Our iOS automation has been running fine for the past year. We recently received a new Mac laptop with newer versions of iOS and Xcode. So I also had to update our iPhone 6 to iOS 11. Once this was all done I am no longer able to see web views. I do have the iOS-webkit-debug-proxy running also.

The app is launched successfully but fails when no webviews are found.

Link to Appium logs

https://gist.github.com/srigney/4eb055ad5115b4e27a384a6a1cb01b69

Code To Reproduce Issue [ Good To Have ]

Caps: DeviceName iPhone 6 PlatformName iOS PlatformVersion 11.0 automationName XCUITest REMOTE_URL http://localhost:4723/wd/hub UDID 59c540e7e9c8d630c0f240bee7305cc82e70ace0 autoWebview True (I didn't used to have this set, but some of the discussions said to try this)

I'm also sending the xcodeOrgId and the xcodeSigningId

artygus commented 7 years ago

could you please do ios_webkit_debug_proxy -V?

srigney commented 7 years ago

Here you go... mydrive$ ios_webkit_debug_proxy -V ios_webkit_debug_proxy 1.8 Built with libimobiledevice v1.2.0, libplist v2.0.0

artygus commented 7 years ago

you need to rebuild utility with latest libimobiledevice, 1.2.1 in development ~2yrs now and contains changes needed for latest iOS versions, but still not marked for release 🙁

brew update
brew reinstall --HEAD libimobiledevice
brew reinstall -s ios-webkit-debug-proxy
srigney commented 7 years ago

ok, I did all that and I'm still getting the same results. mydrive$ ios_webkit_debug_proxy -V ios_webkit_debug_proxy 1.8 Built with libimobiledevice v1.2.1, libplist v2.0.0

artygus commented 7 years ago

Are you sure apps build config is correct, there were a couple of similar issues like #190

srigney commented 7 years ago

Not sure since there is no detail about what app build config was causing the issue.

artygus commented 7 years ago

just in case, did you do Settings > Safari > Advanced > Web Inspector = ON step after iOS update on the device?

if you run ios_webkit_debug_proxy independently, can you see any web views on http://localhost:9221?

srigney commented 7 years ago

The Safari web inspector is on but when I go to http://localhost:9221 I get Safari can't connect to the server. If I go to localhost:27753 I get 'Inspectable pages for iPhone:'

artygus commented 7 years ago

But no pages listed? PS. by independently I meant running ios_webkit_debug_proxy in terminal, without appium

artygus commented 7 years ago

what if you navigate to whatever site in Safari, does iwdp show any pages? If so I think it is app misconfiguration

srigney commented 7 years ago

No pages listed. If I open a page in Safari I am able to see it by going to http://localhost:27753.

Can you give me any ideas of what app config can cause this?

srigney commented 7 years ago

More info, not sure if it matters. The app I am launching is built through Phone Gap and it has a .app extension (as opposed to ipa).

artygus commented 7 years ago

the issue could be related to provisioning profile, e.g. distribution profile doesn't allow debugging

srigney commented 7 years ago

The app is using a Developer signing certificate and it is being installed on the device via Appium. This step will fail if the app isn't signed with a dev cert.

artygus commented 7 years ago

does Safari app on desktop can see your apps UIWebViews?

srigney commented 7 years ago

Do you mean opening Safari browser on the laptop and navigating to the website or opening localhost in safari to see app on device?

artygus commented 7 years ago

Safari browser -> Develop menu -> Your device -> any webviews?

srigney commented 7 years ago

I can see the device is connected but I don't see any webviews, not even when I open a webpage in safari on the device.

srigney commented 7 years ago

This might be a signing issue, I will update after I research more. The app is not showing up on the device under Settings/General/Device Management/Developer App, it is showing under the Enterprise App section. It still seems like it is signed correctly since Appium is able to install the app, but I am looking into it.

DewanshuAwasthi commented 7 years ago

Hi are u able to solve the problem? we are also facing the exact issue

srigney commented 7 years ago

No, the dev is still looking into the provisioning profile. I am also unable to access Native elements in the simulator, which has nothing to do with a provisioning profile.

srigney commented 7 years ago

This was a signing issue (provisioning profile) with the app, you can close.

sumitgos commented 5 years ago

AutomationiMac:~ automation_svc$ ios_webkit_debug_proxy -c 3b5d0182e94c882e5f4bd220a513716a7b65494d:27753 -d ss.add_fd(3) ss.recv fd=3 len=1147 ss.add_server_fd(4) ss.add_fd(6) wi.sendpacket[174]: 00 00 00 AA 62 70 6C 69 73 74 30 30 D2 01 03 02 04 5A 5F ....bplist00.....Z 5F 73 65 6C 65 63 74 6F 72 5F 10 16 5F 72 70 63 5F 72 65 selector.._rpc_re 70 6F 72 74 49 64 65 6E 74 69 66 69 65 72 3A 5A 5F 5F 61 portIdentifier:Z_a 72 67 75 6D 65 6E 74 D1 05 06 5F 10 1A 57 49 52 43 6F 6E rgument.....WIRCon 6E 65 63 74 69 6F 6E 49 64 65 6E 74 69 66 69 65 72 4B 65 nectionIdentifierKe 79 5F 10 24 42 41 31 37 35 32 32 30 2D 42 37 45 32 2D 34 y_.$BA175220-B7E2-4 30 41 44 2D 39 45 38 36 2D 45 38 46 38 31 37 32 32 46 46 0AD-9E86-E8F81722FF 43 30 08 0D 18 31 3C 3F 5C 00 00 00 00 00 00 01 01 00 00 C0...1<?.......... 00 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 ................... 00 00 83 ... ss.recv fd=3 len=773 ss.recv fd=6 len=0 ss.remove_fd(6) Unable to connect to iPhone (3b5d0182e94c882e5f4bd220a513716a7b65494d) Please verify that Settings > Safari > Advanced > Web Inspector = ON ss.remove_server_fd(4)

any solution ?