Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to switch to WebView context on iOS 12.2 #12614

Open
blanco2005 opened this issue May 9, 2019 · 61 comments

Comments

Projects
None yet
@blanco2005
Copy link

commented May 9, 2019

The problem

Since the update to iOS 12.2, I am no longer able to switch into the web-view contexts on iOS Simulators.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.13.0
  • Desktop OS/version used to run Appium: Mac OSX 10.14.4
  • Mobile platform/version under test: iOS 12.2
  • Real device or emulator/simulator: Simulator

Details

By using the same app, same appium version, same version of all the appium dependencies but by using iOS 12.1, the issue disappears and I'm able to correctly switch to web-views. By comparing the appium console log of the two executions (the correct one on iOS 12.1 and the failing one on iOS 12.2), it seems like there is a problem on the contexts returned by the AppiumDriver.getContexts() GET method. In particular, it seems like the webview attributes (title, url) are mapped to the native context PID. As a result, the GET method, as you can see in the attached appium log, returns an array composed of the NATIVE_APP context and a WEBVIEW context which actually maps the native context (please notice that the webview name is WEBVIEW_PID_OF_NATIVE_CONTEXT.2, where .2 indicates the second page of a context. As far as I've seen so far, in all successful executions the webview contexts end with a .1 suffix). When trying to switch to the returned WEBVIEW, an exception occurs.

Excerpt of the log of the failing execution:

[HTTP] --> GET /wd/hub/session/1db198fa-6984-4550-b09b-326ceb44357b/contexts
[HTTP] {}
[debug] [W3C (1db198fa)] Calling AppiumDriver.getContexts() with args: ["1db198fa-6984-4550-b09b-326ceb44357b"]
[debug] [XCUITest] Executing command 'getContexts'
[debug] [iOS] Getting list of available contexts
[debug] [iOS] Retrieving contexts and views
[debug] [iOS] Selecting by url: false
[debug] [RemoteDebugger] Selecting application
[debug] [RemoteDebugger] Current applications available:
[debug] [RemoteDebugger]     Application: 'PID:57976'
[debug] [RemoteDebugger]         id: "PID:57976"
[debug] [RemoteDebugger]         isProxy: false
[debug] [RemoteDebugger]         name: "myApp"
[debug] [RemoteDebugger]         bundleId: "myAppBundleID"
[debug] [RemoteDebugger]         hostId: undefined
[debug] [RemoteDebugger]         isActive: 2
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray:
[debug] [RemoteDebugger]           - id: 2
[debug] [RemoteDebugger]             title: "myTitle" <--- such attributes are mapped on the native context (PID:57976)
[debug] [RemoteDebugger]             url: "myUrl"
[debug] [RemoteDebugger]             isKey: true
[debug] [RemoteDebugger]     Application: 'PID:58003'
[debug] [RemoteDebugger]         id: "PID:58003"
[debug] [RemoteDebugger]         isProxy: true
[debug] [RemoteDebugger]         name: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         bundleId: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         hostId: "PID:57976"
[debug] [RemoteDebugger]         isActive: 1
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray: []
[debug] [RemoteDebugger] Found app id key 'PID:57976' for bundle 'myAppBundleID'
[debug] [RemoteDebugger] Found separate bundleId 'com.apple.WebKit.WebContent' acting as proxy for 'myAppBundleID', with app id 'PID:58003'
[debug] [RemoteDebugger] Trying out the possible app ids: PID:57976, PID:58003
[debug] [RemoteDebugger] Selecting app PID:57976 (try #1 of 20)
[debug] [RemoteDebugger] Sending '_rpc_forwardGetListing:' message to remote debugger (id: 71)
[debug] [RemoteDebugger] Received response from socket send: '["PID:57976",{"1":{"WIRPageIdentifierKey":1,"WI...'
[debug] [RemoteDebugger] Received page change notice for app 'PID:57976' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Finally selecting app PID:57976: [{"id":2,"title":"myTitle","url":"myUrl","isKey":true}]
[debug] [W3C (1db198fa)] Responding to client with driver.getContexts() result: ["NATIVE_APP","WEBVIEW_57976.2"] <-- the webview points to PID 57976, which is the native context. The suffix .2 is weird
[HTTP] <-- GET /wd/hub/session/1db198fa-6984-4550-b09b-326ceb44357b/contexts 200 7 ms - 42
....
....
....
[HTTP] --> POST /wd/hub/session/1db198fa-6984-4550-b09b-326ceb44357b/context
[HTTP] {"name":"WEBVIEW_57976.2"}
[debug] [W3C (1db198fa)] Calling AppiumDriver.setContext() with args: ["WEBVIEW_57976.2","1db198fa-6984-4550-b09b-326ceb44357b"]
[debug] [XCUITest] Executing command 'setContext'
[debug] [iOS] Attempting to set context to 'WEBVIEW_57976.2'
[debug] [RemoteDebugger] Selecting page '2' on app 'PID:57976' and forwarding socket setup
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketSetup:' message to remote debugger (id: 72)
[debug] [RemoteDebugger] Sender key set
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger (id: 73)
[debug] [W3C (1db198fa)] Encountered internal error running command: Error: Remote debugger error with code '-32000': Target not found.
[debug] [W3C (1db198fa)]     at Object.errorHandler (/usr/local/lib/node_modules/appium/node_modules/appium-remote-debugger/lib/remote-debugger-rpc-client.js:246:18)
[debug] [W3C (1db198fa)]     at RpcMessageHandler.handleDataMessage (/usr/local/lib/node_modules/appium/node_modules/appium-remote-debugger/lib/remote-debugger-message-handler.js:194:9)
[debug] [W3C (1db198fa)]     at RpcMessageHandler.handleMessage (/usr/local/lib/node_modules/appium/node_modules/appium-remote-debugger/lib/remote-debugger-message-handler.js:77:13)
[debug] [W3C (1db198fa)]     at RemoteDebuggerRpcClient.handleMessage [as receive] (/usr/local/lib/node_modules/appium/node_modules/appium-remote-debugger/lib/remote-debugger-rpc-client.js:394:35)
[debug] [W3C (1db198fa)]     at Socket.emit (events.js:196:13)
[debug] [W3C (1db198fa)]     at addChunk (_stream_readable.js:290:12)
[debug] [W3C (1db198fa)]     at readableAddChunk (_stream_readable.js:271:11)
[debug] [W3C (1db198fa)]     at Socket.Readable.push (_stream_readable.js:226:10)
[debug] [W3C (1db198fa)]     at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)
[HTTP] <-- POST /wd/hub/session/1db198fa-6984-4550-b09b-326ceb44357b/context 500 8

Result of the getContext method of a successful execution:

[HTTP] --> GET /wd/hub/session/156afb3b-5d7a-42dd-8472-09e6cce7d6a9/contexts
[HTTP] {}
[debug] [W3C (156afb3b)] Calling AppiumDriver.getContexts() with args: ["156afb3b-5d7a-42dd-8472-09e6cce7d6a9"]
[debug] [XCUITest] Executing command 'getContexts'
[debug] [iOS] Getting list of available contexts
[debug] [iOS] Retrieving contexts and views
[debug] [iOS] Selecting by url: false
[debug] [RemoteDebugger] Selecting application
[debug] [RemoteDebugger] Current applications available:
[debug] [RemoteDebugger]     Application: 'PID:58876'
[debug] [RemoteDebugger]         id: "PID:58876"
[debug] [RemoteDebugger]         isProxy: false
[debug] [RemoteDebugger]         name: "myApp"
[debug] [RemoteDebugger]         bundleId: "myAppBundleId"
[debug] [RemoteDebugger]         hostId: undefined
[debug] [RemoteDebugger]         isActive: 2
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray: []
[debug] [RemoteDebugger]     Application: 'PID:58899'
[debug] [RemoteDebugger]         id: "PID:58899"
[debug] [RemoteDebugger]         isProxy: true
[debug] [RemoteDebugger]         name: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         bundleId: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         hostId: "PID:58876"
[debug] [RemoteDebugger]         isActive: 1
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray:
[debug] [RemoteDebugger]           - id: 1
[debug] [RemoteDebugger]             title: "myTitle" <-- here the webview attributes are mapped to the Webcontent process
[debug] [RemoteDebugger]             url: "myUrl"
[debug] [RemoteDebugger]             isKey: false
[debug] [RemoteDebugger] Found app id key 'PID:58876' for bundle 'myAppBundleID'
[debug] [RemoteDebugger] Found separate bundleId 'com.apple.WebKit.WebContent' acting as proxy for 'myAppBundleID', with app id 'PID:58899'
[debug] [RemoteDebugger] Trying out the possible app ids: PID:58876, PID:58899
[debug] [RemoteDebugger] Selecting app PID:58876 (try #1 of 20)
[debug] [RemoteDebugger] Sending '_rpc_forwardGetListing:' message to remote debugger (id: 101)
[debug] [RemoteDebugger] Received response from socket send: '["PID:58876",{"1":{"WIRPageIdentifierKey":1,"WI...'
[debug] [RemoteDebugger] Received page change notice for app 'PID:58876' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Received altered app id, updating from 'PID:58876' to 'PID:58899'
[debug] [RemoteDebugger] Finally selecting app PID:58899: [{"id":1,"title":"myTitle","url":"myUrl","isKey":false}]
[debug] [W3C (156afb3b)] Responding to client with driver.getContexts() result: ["NATIVE_APP","WEBVIEW_58899.1"] <-- here the returned webview maps the second process, i.e., the WebContent process
[HTTP] <-- GET /wd/hub/session/156afb3b-5d7a-42dd-8472-09e6cce7d6a9/contexts 200
@lucaGazzola

This comment has been minimized.

Copy link

commented May 9, 2019

I am experiencing the exact same problem

@mauropota

This comment has been minimized.

Copy link

commented May 9, 2019

experiencing the same problem with the same settings.

@imurchie

This comment has been minimized.

Copy link
Member

commented May 10, 2019

The failing logs look just how I would expect them to.

Can you post the full logs? There is something else going wrong.

@blanco2005

This comment has been minimized.

Copy link
Author

commented May 13, 2019

Ok, I will post the full log as soon as possible. Meanwhile, could you please explain me why you say the output is what you expect? I mean, why in the failing execution (on iOS 12.2) the title and the url of the webview are associated with the first process (that is the native context), while in the successful execution (on iOS 12.1) the title and the url of the webview are associated with the second process (that is the webview context)? Could you explain me (for sake of curiosity) this difference and inconsistency?

@alexyablonskyi

This comment has been minimized.

Copy link

commented May 13, 2019

Faced with the same problem

@blanco2005

This comment has been minimized.

Copy link
Author

commented May 13, 2019

@ggerashchenko

This comment has been minimized.

Copy link

commented May 14, 2019

Hi! I am having similar issue. Also with Appium 1.13.0 and iOS 12.2. Do you guys have any updates on it?
After investigation I found that Appium 1.13 with iOS 12.2 some times working if instead of driver.findElement(By).click is used custom tap action:

public void tapByElement(WebElement element) {
	Point location = element.getLocation();
	Dimension size = element.getSize();

	TouchAction touchAction = new TouchAction(device.getAppiumDriver());
	touchAction
		.press(PointOption.point((location.x + size.width / 2), (location.y + size.height / 2)))
		.release()
		.perform();
}

But it is unstable.

Appium 1.13 with iOS 12.1 is able to do driver.findElement(By).click.

@imurchie

This comment has been minimized.

Copy link
Member

commented May 15, 2019

Well, that is not the native context. It is just another app within the web inspector.

I'm concerned, seeing the full logs, that certain information is missing. I expect some debugging information to be there, before the actual contexts are seen:

[HTTP] --> GET /wd/hub/session/cd005e26-a83b-4b2c-b329-2d9566099260/contexts
[HTTP] {}
[debug] [MJSONWP (cd005e26)] Calling AppiumDriver.getContexts() with args: ["cd005e26-a83b-4b2c-b329-2d9566099260"]
[debug] [XCUITest] Executing command 'getContexts'
[debug] [iOS] Getting list of available contexts
[debug] [iOS] Retrieving contexts and views
[debug] [iOS] Selecting by url: false
[debug] [RemoteDebugger] useNewSafari --> false
[debug] [RemoteDebugger] Checking which communication style to use (non-Safari on platform version '12.2')
[debug] [RemoteDebugger] Platform version equal or higher than '12.2': true
[RemoteDebugger] Setting communication protocol: using full Web Inspector protocol communication
[debug] [RemoteDebugger] Connecting to remote debugger through unix domain socket: '/private/tmp/com.apple.launchd.52bYesVPQJ/com.apple.webinspectord_sim.socket'
[debug] [RemoteDebugger] Debugger socket connected
[debug] [RemoteDebugger] Sending connection key request
[debug] [RemoteDebugger] Sending '_rpc_reportIdentifier:' message to remote debugger (id: 0)

What version of appium-remote-debugger is being used (run npm ls -g appium-remote-debugger)?

@blanco2005

This comment has been minimized.

Copy link
Author

commented May 16, 2019

This is the result of the command:

├─┬ appium@1.13.0
│ ├─┬ appium-ios-driver@4.2.3
│ │ └── appium-remote-debugger@4.3.0
│ ├─┬ appium-xcuitest-driver@2.113.2
│ │ └── appium-remote-debugger@4.3.0  deduped
│ └─┬ appium-youiengine-driver@1.1.2
│   └─┬ appium-ios-driver@2.13.2
│     └── appium-remote-debugger@3.22.3
└── appium-remote-debugger@4.1.0
@imurchie

This comment has been minimized.

Copy link
Member

commented May 16, 2019

Ok. The problem is the last entry, appium-remote-debugger@4.1.0. This should not be there (it is not a direct dependency of appium, and is a version too early to handle iOs 12.2 correctly.

Can you try to uninstall and reinstall Appium?

@lucaGazzola

This comment has been minimized.

Copy link

commented May 16, 2019

Ok. The problem is the last entry, appium-remote-debugger@4.1.0. This should not be there (it is not a direct dependency of appium, and is a version too early to handle iOs 12.2 correctly.

Can you try to uninstall and reinstall Appium?

I am experiencing the same problem with this configuration, I don't think that's the issue

└─┬ appium@1.13.0
  ├─┬ appium-ios-driver@4.2.3
  │ └── appium-remote-debugger@4.3.0 
  ├─┬ appium-xcuitest-driver@2.113.2
  │ └── appium-remote-debugger@4.3.0  deduped
  └─┬ appium-youiengine-driver@1.1.2
    └─┬ appium-ios-driver@2.13.2
      └── appium-remote-debugger@3.22.3 
@blanco2005

This comment has been minimized.

Copy link
Author

commented May 16, 2019

I confirm that the issue is still present after removing appium-remote-debugger 4.1.0.
The log regarding retrieving and setting the context is now the following one:

[debug] [RemoteDebugger] Page changed: {"1":{"WIRPageIdentifierKey":1,"WIRTitleKey":"JSContext","WIRTypeKey":"WIRTypeJavaScript"},"2":{"WIRTitleKey":"","WIRTypeKey":"WIRTypeWeb","WIRURLKey":"about:blank","WIRPageIdentifierKey":2}}
[debug] [RemoteDebugger] Notified that new application 'PID:96566' has connected
[debug] [RemoteDebugger] Received page change notice for app 'PID:96566' but listening for 'PID:96550'. Ignoring.
[debug] [RemoteDebugger] Notified that application 'PID:96566' has been updated
[debug] [RemoteDebugger] Page changed: {"1":{"WIRPageIdentifierKey":1,"WIRTitleKey":"JSContext","WIRTypeKey":"WIRTypeJavaScript"},"2":{"WIRTitleKey":"Best deals for your holidays","WIRTypeKey":"WIRTypeWeb","WIRURLKey":"myUrl,"WIRPageIdentifierKey":2}}
[debug] [RemoteDebugger] Received page change notice for app 'PID:96566' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Received page change notice for app 'PID:96566' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Received page change notice for app 'PID:96566' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Page changed: {"1":{"WIRPageIdentifierKey":1,"WIRTitleKey":"JSContext","WIRTypeKey":"WIRTypeJavaScript"},"2":{"WIRTitleKey":"myTitle","WIRTypeKey":"WIRTypeWeb","WIRURLKey":"myNewUrl","WIRPageIdentifierKey":2}}
[debug] [RemoteDebugger] Page changed: {"1":{"WIRPageIdentifierKey":1,"WIRTitleKey":"JSContext","WIRTypeKey":"WIRTypeJavaScript"},"2":{"WIRTitleKey":"myNewTitle","WIRTypeKey":"WIRTypeWeb","WIRURLKey":"myUrl","WIRPageIdentifierKey":2}}
[HTTP] --> GET /wd/hub/session/7045602e-a3c1-4f48-87ef-62d0ebefa8af/contexts
[HTTP] {}
[debug] [W3C (7045602e)] Calling AppiumDriver.getContexts() with args: ["7045602e-a3c1-4f48-87ef-62d0ebefa8af"]
[debug] [XCUITest] Executing command 'getContexts'
[debug] [iOS] Getting list of available contexts
[debug] [iOS] Retrieving contexts and views
[debug] [iOS] Selecting by url: false
[debug] [RemoteDebugger] Selecting application
[debug] [RemoteDebugger] Current applications available:
[debug] [RemoteDebugger]     Application: 'PID:96550'
[debug] [RemoteDebugger]         id: "PID:96550"
[debug] [RemoteDebugger]         isProxy: false
[debug] [RemoteDebugger]         name: "myapp"
[debug] [RemoteDebugger]         bundleId: "com.myapp.bundleid"
[debug] [RemoteDebugger]         hostId: undefined
[debug] [RemoteDebugger]         isActive: 2
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray:
[debug] [RemoteDebugger]           - id: 2
[debug] [RemoteDebugger]             title: "myNewTitle"
[debug] [RemoteDebugger]             url: "myNewUrl"
[debug] [RemoteDebugger]             isKey: false
[debug] [RemoteDebugger]     Application: 'PID:96566'
[debug] [RemoteDebugger]         id: "PID:96566"
[debug] [RemoteDebugger]         isProxy: true
[debug] [RemoteDebugger]         name: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         bundleId: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         hostId: "PID:96550"
[debug] [RemoteDebugger]         isActive: 1
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray: []
[debug] [RemoteDebugger] Found app id key 'PID:96550' for bundle 'com.myapp.bundleid'
[debug] [RemoteDebugger] Found separate bundleId 'com.apple.WebKit.WebContent' acting as proxy for 'com.myapp.bundleid', with app id 'PID:96566'
[debug] [RemoteDebugger] Trying out the possible app ids: PID:96550, PID:96566
[debug] [RemoteDebugger] Selecting app PID:96550 (try #1 of 20)
[debug] [RemoteDebugger] Sending '_rpc_forwardGetListing:' message to remote debugger (id: 61)
[debug] [RemoteDebugger] Received response from socket send: '["PID:96550",{"1":{"WIRPageIdentifierKey":1,"WI...'
[debug] [RemoteDebugger] Received page change notice for app 'PID:96550' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Finally selecting app PID:96550: [{"id":2,"title":"myTitle","url":"myUrl","isKey":false}]
[debug] [W3C (7045602e)] Responding to client with driver.getContexts() result: ["NATIVE_APP","WEBVIEW_96550.2"]
[HTTP] <-- GET /wd/hub/session/7045602e-a3c1-4f48-87ef-62d0ebefa8af/contexts 200 95 ms - 42
[HTTP]
[HTTP] --> POST /wd/hub/session/7045602e-a3c1-4f48-87ef-62d0ebefa8af/context
[HTTP] {"name":"WEBVIEW_96550.2"}
[debug] [W3C (7045602e)] Calling AppiumDriver.setContext() with args: ["WEBVIEW_96550.2","7045602e-a3c1-4f48-87ef-62d0ebefa8af"]
[debug] [XCUITest] Executing command 'setContext'
[debug] [iOS] Attempting to set context to 'WEBVIEW_96550.2'
[debug] [RemoteDebugger] Selecting page '2' on app 'PID:96550' and forwarding socket setup
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketSetup:' message to remote debugger (id: 62)
[debug] [RemoteDebugger] Sender key set
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger (id: 63)
[RemoteDebugger] Setting communication protocol: using Target-based communication
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger (id: 64)
[debug] [W3C (7045602e)] Encountered internal error running command: Error: Remote debugger error with code '-32000': Target not found.
[debug] [W3C (7045602e)]     at Object.errorHandler (/usr/local/lib/node_modules/appium/node_modules/appium-remote-debugger/lib/remote-debugger-rpc-client.js:246:18)
[debug] [W3C (7045602e)]     at RpcMessageHandler.handleDataMessage (/usr/local/lib/node_modules/appium/node_modules/appium-remote-debugger/lib/remote-debugger-message-handler.js:194:9)
[debug] [W3C (7045602e)]     at RpcMessageHandler.handleMessage (/usr/local/lib/node_modules/appium/node_modules/appium-remote-debugger/lib/remote-debugger-message-handler.js:77:13)
[debug] [W3C (7045602e)]     at RemoteDebuggerRpcClient.handleMessage [as receive] (/usr/local/lib/node_modules/appium/node_modules/appium-remote-debugger/lib/remote-debugger-rpc-client.js:394:35)
[debug] [W3C (7045602e)]     at Socket.emit (events.js:196:13)
[debug] [W3C (7045602e)]     at addChunk (_stream_readable.js:290:12)
[debug] [W3C (7045602e)]     at readableAddChunk (_stream_readable.js:271:11)
[debug] [W3C (7045602e)]     at Socket.Readable.push (_stream_readable.js:226:10)
[debug] [W3C (7045602e)]     at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)
[HTTP] <-- POST /wd/hub/session/7045602e-a3c1-4f48-87ef-62d0ebefa8af/context 500 61 ms - 615
[HTTP]
[debug] [RemoteDebugger] Received page change notice for app 'PID:96566' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Received page change notice for app 'PID:96550' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Notified that application 'PID:96550' has been updated
@imurchie

This comment has been minimized.

Copy link
Member

commented May 16, 2019

Full logs? That snippet is not all that matters.

@imurchie

This comment has been minimized.

Copy link
Member

commented May 16, 2019

@lucaGazzola Can you post the logs for a run (as a link to a gist)?

@DungHoangNVG

This comment has been minimized.

Copy link

commented May 17, 2019

Hi! I am having similar issue. Also with Appium 1.13.0 and iOS 12.2. Do you guys have any updates on it?
After investigation I found that Appium 1.13 with iOS 12.2 some times working if instead of driver.findElement(By).click is used custom tap action:

public void tapByElement(WebElement element) {
	Point location = element.getLocation();
	Dimension size = element.getSize();

	TouchAction touchAction = new TouchAction(device.getAppiumDriver());
	touchAction
		.press(PointOption.point((location.x + size.width / 2), (location.y + size.height / 2)))
		.release()
		.perform();
}

But it is unstable.

Appium 1.13 with iOS 12.1 is able to do driver.findElement(By).click.

I also found element's click action with Appium 1.13.0 and iOS 12.2 is not reliable even it did work properly with Appium 1.13.0 and iOS 12.1. I will try to use customized tap action in the native app context

@lucaGazzola

This comment has been minimized.

Copy link

commented May 17, 2019

@imurchie

This comment has been minimized.

Copy link
Member

commented May 17, 2019

@lucaGazzola For some reason the Safari Web Inspector is not returning any valid pages. Can you see the page if you inspect from within Safari?

@simplezhang1990

This comment has been minimized.

Copy link

commented May 20, 2019

is there any update on this issue? I have the same issue

@lucaGazzola

This comment has been minimized.

Copy link

commented May 20, 2019

@lucaGazzola For some reason the Safari Web Inspector is not returning any valid pages. Can you see the page if you inspect from within Safari?

@imurchie if I run the application in the simulator by hand, when I inspect it with the safari inspector it shows two contexts, both selectable
selectable

if I run the test case with appium, when the test reaches the same webview, the inspector shows both contexts, but one is greyed out and hence not selectable
not_selectable

@alexyablonskyi

This comment has been minimized.

Copy link

commented May 21, 2019

Updates from my side. I have updated my command line tools and issue does not reproduce anymore.
Screen Shot 2019-05-21 at 18 29 02

@lucaGazzola

This comment has been minimized.

Copy link

commented May 21, 2019

@alexyablonskyi what do you see when you run xcode-select --version?

@alexyablonskyi

This comment has been minimized.

Copy link

commented May 22, 2019

@lucaGazzola xcode-select version 2354

@lucaGazzola

This comment has been minimized.

Copy link

commented May 22, 2019

@alexyablonskyi we have the same version, the issue persists on my machine

@imurchie

This comment has been minimized.

Copy link
Member

commented May 22, 2019

What do you get for the tools version:

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
@lucaGazzola

This comment has been minimized.

Copy link

commented May 22, 2019

package-id: com.apple.pkg.CLTools_Executables
version: 10.2.1.0.1.1554506761
volume: /
location: /
install-time: 1555619471
groups: com.apple.FindSystemFiles.pkg-group 
@vasogiamarelou

This comment has been minimized.

Copy link

commented May 31, 2019

@DungHoangNVG

This comment has been minimized.

Copy link

commented Jun 3, 2019

I have just resolved the issue by chance. First and foremost, there are indeed differences between iOS platform 12.1 and 12.2 (and even 12.3 I haven't tested it yet). From my side, please try to update the latest MacOS and Xcode (and Safari Technology Preview as above - if any). Then ensure removing and re-installing the latest Appium (1.13.0 thought) and WedriverIO (if you are using it). We even might need to do a fresh installation of brew formulae as diagnosed by appium-doctor. Hope it can help.

@lucaGazzola

This comment has been minimized.

Copy link

commented Jun 11, 2019

@DungHoangNVG Could you post a gist with your appium log? I'm not sure our issues are related
@imurchie unfortunately I can't share the application, but I will try and reproduce it on another one

@imurchie

This comment has been minimized.

Copy link
Member

commented Jun 11, 2019

It's got to do with target maintenance, it seems. I will explore a little more.

@lfalkner

This comment has been minimized.

Copy link

commented Jun 11, 2019

Our team �has been through many issues that probably took days to resolve but after all, the underlying issue might come from your own environment preparation and installation. I'm sure that our team can run on sim iOS 12.2 without problems.

Could we get a hint on what we need to do to fix our environments? I've tried all the suggestions on this thread and still am getting the same response of 'Target not found'.

Xcode: 10.2.1 (10E1001)

MacOS: 10.14.5

iOS: 12.2 (simulator)

Appium source: 1.14.0-beta.1 (REV 39c03cf)

uninstall and install of appium@beta

appium-remote-debugger@4.3.0

@imurchie

This comment has been minimized.

Copy link
Member

commented Jun 11, 2019

I still cannot reproduce locally, but I have some ideas about the problem. Once a fix is published I will report here for you to try it out.

Thank you for the patience!

@imurchie

This comment has been minimized.

Copy link
Member

commented Jun 11, 2019

appium-remote-debugger@4.4.0 has been published, with what I hope is some logic that will help. If you reinstall the beta you ought to get it. If you could try it and post here the results (logs, as a https://gist.github.com).

@lucaGazzola

This comment has been minimized.

Copy link

commented Jun 11, 2019

thank you @imurchie , I will try asap

@DungHoangNVG

This comment has been minimized.

Copy link

commented Jun 12, 2019

My environment is:

  • mac 10.14.5
  • xcode 10.2.1 (10E1001)
  • node 10.15.3 & npm 6.9.0
  • sim iOS 12.2
  • and result of npm ls appium-remote-debugger
appium-starter@1.0.0 /Users/dungnguyen/appium-starter
└─┬ appium@1.13.0
  ├─┬ appium-ios-driver@4.2.3
  │ └── appium-remote-debugger@4.3.0 
  ├─┬ appium-xcuitest-driver@2.113.2
  │ └── appium-remote-debugger@4.3.0  deduped
  └─┬ appium-youiengine-driver@1.1.2
    └─┬ appium-ios-driver@2.13.2
      └── appium-remote-debugger@3.22.3 
@ashishyadav2020

This comment has been minimized.

Copy link

commented Jun 12, 2019

after updating to appium-remote-debugger@4.4.0, It is now able to switch to WebView on iOS 12.3.1.
@imurchie Thank you so much man!

anyone struggling, I have tried following:

  • Install fresh appium@beta or try 'npm uninstall appium && npm install appium@beta' (use -g if running globally).
  • update appium-remote-debugger@4.4.0

@imurchie when we can expect this in standard Appium release?

@lucaGazzola

This comment has been minimized.

Copy link

commented Jun 12, 2019

I still experience the same problem, but the error message seems different from the one I used to get. Here you can find the full appium log.

@imurchie

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

@lucaGazzola This is a different issue than some. Can you tell me the type of webview it is that is supposed to be there? UiWebView? WkWebView? SafariViewController? That sort if thing. Any details that might help me reproduce and, hopefully, fix.

@lfalkner

This comment has been minimized.

Copy link

commented Jun 12, 2019

Thanks so much for digging into this! I'm seeing the same behavior as @lucaGazzola. I'm still unable to switch contexts, with the new error message.

@imurchie

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

@lfalkner What is the new error message? Can you post the logs, as a link to a https://gist.github.com? I'd love to get this working for everyone!

@lfalkner

This comment has been minimized.

@lucaGazzola

This comment has been minimized.

Copy link

commented Jun 12, 2019

@lucaGazzola This is a different issue than some. Can you tell me the type of webview it is that is supposed to be there? UiWebView? WkWebView? SafariViewController? That sort if thing. Any details that might help me reproduce and, hopefully, fix.

@imurchie WkWebView

@imurchie

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

@lfalkner Can you provide the full logs? I'd like to see if the targets are coming in and we are losing them somehow. Or if it is never being reported at all. Which would break some assumptions I've made.

@imurchie

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

@lucaGazzola Ok. I'll modify my tests. Thanks!

@lfalkner

This comment has been minimized.

@imurchie

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

@lucaGazzola Well, it's not the fact of it being a WkWebView, since I can run tests against one. :(

Now I guess we move to questions of ios-webkit-debug-proxy and its dependencies.

What is the output of:

  1. brew list --versions usbmuxd
  2. brew list --versions ios-webkit-debug-proxy
  3. brew list --versions libimobiledevice
@lfalkner

This comment has been minimized.

Copy link

commented Jun 12, 2019

  1. usbmuxd HEAD-873252d_1
  2. ios-webkit-debug-proxy HEAD-fa3e206
  3. libimobiledevice HEAD-eea4f1b_3
@DungHoangNVG

This comment has been minimized.

Copy link

commented Jun 13, 2019

I guess you also installed ideviceinstaller. A hint from me, even though the installation of ideviceinstaller will also deliver its dependency libimobiledevice (might be the latest), another sole installation of libimobiledevice is still necessary to rebuild utility with the latest HEAD.

@lucaGazzola

This comment has been minimized.

Copy link

commented Jun 13, 2019

@imurchie

usbmuxd 1.0.10_1
ios-webkit-debug-proxy 1.8.4
libimobiledevice 1.2.0_3
@imurchie

This comment has been minimized.

Copy link
Member

commented Jun 13, 2019

@lucaGazzola Can you try upgrading these, to HEAD on all? There have been updates to them to account for developments in recent iOS versions.

brew uninstall ios-webkit-debug-proxy && brew install ios-webkit-debug-proxy --HEAD and such for all three?

@lfalkner

This comment has been minimized.

Copy link

commented Jun 13, 2019

@imurchie just to follow up, I'm able to automate on a physical device, using the same setup, but I'm not able to automate using a simulator. I'm not sure if that helps provide any insight.

@lucaGazzola

This comment has been minimized.

Copy link

commented Jun 17, 2019

I tried updating to head, now I have these versions for the dependencies you recommended:

usbmuxd HEAD-ca24570_1
ios-webkit-debug-proxy HEAD-fa3e206
libimobiledevice HEAD-ddba0b5_3

but the problem still persist:

[debug] [W3C (d843ce6d)] Calling AppiumDriver.getContexts() with args: ["d843ce6d-de13-4359-ad81-630edf1a4ea4"]
[debug] [XCUITest] Executing command 'getContexts'
[debug] [iOS] Getting list of available contexts
[debug] [iOS] Retrieving contexts and views
[debug] [iOS] Selecting by url: false 
[debug] [RemoteDebugger] Selecting application
[debug] [RemoteDebugger] Current applications available:
[debug] [RemoteDebugger]     Application: 'PID:83233'
[debug] [RemoteDebugger]         id: "PID:83233"
[debug] [RemoteDebugger]         isProxy: false
[debug] [RemoteDebugger]         name: "xx.com"
[debug] [RemoteDebugger]         bundleId: "com.xx.x.x"
[debug] [RemoteDebugger]         hostId: undefined
[debug] [RemoteDebugger]         isActive: 2
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray:
[debug] [RemoteDebugger]           - id: 2
[debug] [RemoteDebugger]             title: "title"
[debug] [RemoteDebugger]             url: "url"
[debug] [RemoteDebugger]             isKey: true
[debug] [RemoteDebugger]     Application: 'PID:83295'
[debug] [RemoteDebugger]         id: "PID:83295"
[debug] [RemoteDebugger]         isProxy: true
[debug] [RemoteDebugger]         name: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         bundleId: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         hostId: "PID:83233"
[debug] [RemoteDebugger]         isActive: 1
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray: []
[debug] [RemoteDebugger] Found app id key 'PID:83233' for bundle 'com.xx.x.x'
[debug] [RemoteDebugger] Found separate bundleId 'com.apple.WebKit.WebContent' acting as proxy for 'com.xx.x.x', with app id 'PID:83295'
[debug] [RemoteDebugger] Trying out the possible app ids: PID:83233, PID:83295
[debug] [RemoteDebugger] Selecting app PID:83233 (try #1 of 20)
[debug] [RemoteDebugger] Current applications available:
[debug] [RemoteDebugger]     Application: 'PID:83233'
[debug] [RemoteDebugger]         id: "PID:83233"
[debug] [RemoteDebugger]         isProxy: false
[debug] [RemoteDebugger]         name: "xx.com"
[debug] [RemoteDebugger]         bundleId: "com.xx.x.x"
[debug] [RemoteDebugger]         hostId: undefined
[debug] [RemoteDebugger]         isActive: 2
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray:
[debug] [RemoteDebugger]           - id: 2
[debug] [RemoteDebugger]             title: "title"
[debug] [RemoteDebugger]             url: "url"
[debug] [RemoteDebugger]             isKey: true
[debug] [RemoteDebugger]     Application: 'PID:83295'
[debug] [RemoteDebugger]         id: "PID:83295"
[debug] [RemoteDebugger]         isProxy: true
[debug] [RemoteDebugger]         name: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         bundleId: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         hostId: "PID:83233"
[debug] [RemoteDebugger]         isActive: 1
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray: []
[debug] [RemoteDebugger] Page changed: {
[debug] [RemoteDebugger]   "1": {
[debug] [RemoteDebugger]     "WIRPageIdentifierKey": 1,
[debug] [RemoteDebugger]     "WIRTitleKey": "JSContext",
[debug] [RemoteDebugger]     "WIRTypeKey": "WIRTypeJavaScript"
[debug] [RemoteDebugger]   },
[debug] [RemoteDebugger]   "2": {
[debug] [RemoteDebugger]     "WIRTitleKey": "title",
[debug] [RemoteDebugger]     "WIRTypeKey": "WIRTypeWeb",
[debug] [RemoteDebugger]     "WIRURLKey": "url",
[debug] [RemoteDebugger]     "WIRPageIdentifierKey": 2,
[debug] [RemoteDebugger]     "WIRConnectionIdentifierKey": "8e90897a-58c0-494b-9e98-0c65534c4b56"
[debug] [RemoteDebugger]   }
[debug] [RemoteDebugger] }
[debug] [RemoteDebugger] Current applications available:
[debug] [RemoteDebugger]     Application: 'PID:83233'
[debug] [RemoteDebugger]         id: "PID:83233"
[debug] [RemoteDebugger]         isProxy: false
[debug] [RemoteDebugger]         name: "xx.com"
[debug] [RemoteDebugger]         bundleId: "com.xx.x.x"
[debug] [RemoteDebugger]         hostId: undefined
[debug] [RemoteDebugger]         isActive: 2
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray:
[debug] [RemoteDebugger]           - id: 2
[debug] [RemoteDebugger]             title: "title"
[debug] [RemoteDebugger]             url: "url"
[debug] [RemoteDebugger]             isKey: true
[debug] [RemoteDebugger]     Application: 'PID:83295'
[debug] [RemoteDebugger]         id: "PID:83295"
[debug] [RemoteDebugger]         isProxy: true
[debug] [RemoteDebugger]         name: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         bundleId: "com.apple.WebKit.WebContent"
[debug] [RemoteDebugger]         hostId: "PID:83233"
[debug] [RemoteDebugger]         isActive: 1
[debug] [RemoteDebugger]         isAutomationEnabled: false
[debug] [RemoteDebugger]         pageArray: []
[debug] [RemoteDebugger] Page changed: {
[debug] [RemoteDebugger]   "1": {
[debug] [RemoteDebugger]     "WIRPageIdentifierKey": 1,
[debug] [RemoteDebugger]     "WIRTitleKey": "JSContext",
[debug] [RemoteDebugger]     "WIRTypeKey": "WIRTypeJavaScript"
[debug] [RemoteDebugger]   },
[debug] [RemoteDebugger]   "2": {
[debug] [RemoteDebugger]     "WIRTitleKey": "title",
[debug] [RemoteDebugger]     "WIRTypeKey": "WIRTypeWeb",
[debug] [RemoteDebugger]     "WIRURLKey": "url",
[debug] [RemoteDebugger]     "WIRPageIdentifierKey": 2,
[debug] [RemoteDebugger]     "WIRConnectionIdentifierKey": "8e90897a-58c0-494b-9e98-0c65534c4b56"
[debug] [RemoteDebugger]   }
[debug] [RemoteDebugger] }
[debug] [RemoteDebugger] Received page change notice for app 'PID:83295' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Received page change notice for app 'PID:83295' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Received page change notice for app 'PID:83295' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Received page change notice for app 'PID:83295' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Received page change notice for app 'PID:83295' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Received page change notice for app 'PID:83295' but the listing has not changed. Ignoring.
(node:82197) UnhandledPromiseRejectionWarning: Error: No targets found, unable to communicate with device
    at /usr/local/lib/node_modules/appium/node_modules/appium-remote-debugger/lib/rpc-client.js:34:15
    at fn (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:35:19)
    at fn (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:18:19)
(node:82197) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:82197) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[debug] [RemoteDebugger] Received page change notice for app 'PID:83295' but the listing has not changed. Ignoring.
[debug] [RemoteDebugger] Received page change notice for app 'PID:83295' but the listing has not changed. Ignoring.
@abilashkar

This comment has been minimized.

Copy link

commented Jun 18, 2019

@ashishyadav2020 is this the same issue you faced?

#12698

@ashishyadav2020

This comment has been minimized.

Copy link

commented Jun 18, 2019

@abilashkar for #12698, you mentioned that switch between WEBVIEW and NATIVE is happening (though your Appium logs having very much similar exception).
But here it is problem with initial switch to WEBVIEW.

@chandra306

This comment has been minimized.

Copy link

commented Jul 1, 2019

Hi All,
We are experiencing the same issue. Did any one find a work around or resolution for the same. If yes, can you please share. It helps and thanks in advance.

@abilashkar

This comment has been minimized.

Copy link

commented Jul 1, 2019

@chandra306 yes we have resolved this issue please refer #12698

@chandra306

This comment has been minimized.

Copy link

commented Jul 1, 2019

Thank you abilashkar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.