Trying to get info that I see in the logs when page changes


I’m automating a hybrid app using the Javascript wd. On iOS simulator, I can tap an external web link in my app and it opens a new safari window with the target link. When this happens, I notice in the appium log that I get info like this:

`[debug] [RemoteDebugger] Page changed: {“1”:{“WIRTitleKey”:“My Store - Shop”,“WIRTypeKey”:“WIRTypeWeb”,“WIRURLKey”:“",“WIRPageIdentifierKey”:1,“WIRConnectionIdentifierKey”:"D2872FE1-18FB-46F5-973A-9923B83676E7”}}

[debug] [iOS] Remote debugger notified us of a new page listing: {“appIdKey”:“30424”,“pageArray”:[{“id”:1,“title”:“My Store - Shop”,“url”:“","isKey”:true}]}`

Without interacting with the mobile safari window, is it possible for me to get the url out of this data object within appium? How? All I need to do is verify the URL matches what is in the spec. I’m hoping that since this data is being logged, it is also available programmatically with some kind of driver.whatever() method. I’m really really hoping I don’t have to write some kind of logfile monitor and pull it out of there.



Try mobile: getContexts or simply getUrl API. In the worst case it is also possible to extract the server logs and parse them.

Thanks, I’ll give that a try!