I am new to python, Below are the snippets we tried and failed to switch to web view from native view
-
python
assuming we have an initialized driver
object for an app
switch to webview
webview = driver.contexts.last
driver.switch_to.context(webview)
do some webby stuff
driver.find_element(:css, “.green_button”).click
switch back to native view
driver.switch_to.context(driver.contexts.first)
do more native testing if I want
driver.quit()
Result : Shows driver exception
-
Can't switch context to webview
Result : NoSuchContextException: Message: No such context found.
Is this the correct approach or is there any other way.Could anyone please help me if you have faced the same issue and resolved it.
Thanks in advance.