I'm using Appium 1.4.13 & ruby appium_lib version 2.1.1 on OSX 10.11.1
As basis for switching contexts I am using the file github hybrid.md. The first Steps say GET session/:sessionId/contexts and POST session/:sessionId/context.
Getting session is done with following approach found in example file device.rb
def available contexts_
execute(:available_contexts, {} ) || []
end
Now in console I can see all available contexts {"status":0,"value":["NATIVE_APP","WEBVIEW_1"}
According to documentation switching now should be easily done with one of these lines that I tried:
set_context "WEBVIEW_1"
OR
def available_contexts
execute(:set_context, "WEBVIEW_1"
end
OR as one complete function
def available_contexts
execute(:available_contexts, {} ) || [] #This works
webview = @driver.contexts.last
webview1 = @driver.switch_to.context(webview)
puts webview1
end
I don't get any error message for this in Terminal, so I tried accessing a webview text field afterwards find_element(:name, "E-Mail-Adresse / Benutzername").click. Response is Selenium::WebDriver::Error::NoSuchElementError , so switching didn't work.
Anything I oversee here?