Hello,
I'm doing automation on real android device with Appium on Mac with Ruby.
I see that's it's possible to go in a webview in an app but I don't sucess to do it.
I've read on appium website that I have to do :
**Given(/^I switch to webview$/) do
webview = @driver.contexts.last
@driver.switch_to.context(webview)
end
Given(/^I switch out of webview$/) do
@driver.switch_to(@driver.contexts.first)
end**
But when I try that, I have "undefined method `contexts' for Selenium::WebDriver::Driver:0x007fefc17d09c0 (NoMethodError)"
I have the last gem of appium_lib and selenium-webdriver.
I've put this in my env.rb
require 'rubygems'
require 'watir-webdriver'
require 'rspec'
require 'page-object'
require 'page-object/page_factory'
require 'require_relative'
require 'yaml'
require 'selenium-webdriver'
require 'appium_lib'
The "classic" fonctions of watir selenium are working (like find_element, click....)
So why "contexts" not ?
Maybe I'm missing something.
I decalre:
*capabilities =
{
'appPackage'=> 'myapp.demo,
'appActivity'=> '.MainActivity',
'platformName' => 'Android',
'deviceName' => 'Galaxy S4',
}
server_url = 'http://127.0.0.1:4723/wd/hub'
@driver = Selenium::WebDriver.for(:remote, desired_capabilities: capabilities, url: server_url)
@browser = Watir::Browser.new @driver
@browser.driver.manage.timeouts.implicit_wait = 30*
Thanks !