Wd.source() no such method

python bindings, appium 1.22, new ipad
I’m on a mac (macs are unfamiliar to me) because I’m controlling a native app on an ipad.
after connecting, I can control my app, by whenever an element locator fails I really would like to dump out the dom in a stack trace like way to allow the triage to not require me open the inspector to find that a dev renamed or moved an element locator.
I have used this dom dumping when using selenium driver.get_page_source and then parsing out the interesting elements.
The github docs show that there is a source function, but give no clues how to invoke it at all other than it has a mandatory parameter xml/json, but how do I call it from python? Whay context do I need to call it?

Hope the next person sees this. Basically you, you have to call the scripts for mobile extensions yourself, they are not generalised for you in the python bindings at any point :frowning:

print(driver.execute_script(‘mobile: source’, {‘format’: ‘xml’}))

Is what you want, you have to have spent about an hour watching tutorials that don’t cover extension documentation…but this is the magic
https://appium.io/docs/en/commands/mobile-command/index.html
then go and scroll down until you get to

1 Like