Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for context switching #20

Closed
tmulry opened this issue Mar 16, 2015 · 5 comments
Closed

Support for context switching #20

tmulry opened this issue Mar 16, 2015 · 5 comments

Comments

@tmulry
Copy link

tmulry commented Mar 16, 2015

Hi-
I have searched through the code/issues, and although I see some references to context switching and hybrid apps, they do not appear to be supported by the code. I have patched the code(example below) for my own use.

module Appium::Capybara
  class Appium::Capybara::Driver
    def set_context context
      browser.set_context context
    end
  end
end

Has anyone tried to implement this? It seems fairly straightforward and works fine in iOS and selendroid, but I am running into an issue with chromedriver on sauce when I try to switch contexts. Is there any documented reason why the context methods haven't been implemented?

Edit: The chromedriver error is below. I don't get any error when I run this locally on a real device or run this request straight through the vanilla appium selenium driver.

Did not get session redirect from Chromedriver (Selenium::WebDriver::Error::UnknownError)
      ./common/appium.rb:9:in `set_context'
@maudineormsby
Copy link
Contributor

Thanks for bringing this up - the reason it's not in appium capybara is just that it hasn't been added yet; it'd be fine to add. As a workaround you could use the underlying ruby_lib methods directly as page.driver.appium_driver.available_context and page.driver.appium_driver.set_context.

I haven't seen the issue with Chromedriver; can you provide a repro case for that? Is it happening in a webview only?

I'd welcome a patch to add set_context and available_contexts to appium_capybara, or even suggestions as to what the methods should be.

@bootstraponline
Copy link
Member

The did not get session redirect is a common problem with chromedriver. It's not Ruby specific.

@tmulry
Copy link
Author

tmulry commented Mar 17, 2015

@bootstraponline , Yeah I did not see the full scope of that chromedriver issue at first. I will put together a pull request to add those context methods when I get some time.

@tmulry
Copy link
Author

tmulry commented Mar 17, 2015

FWIW, switching my caps to use appiumVersion="1.3.6" on all devices that use chromedriver seems to have resolved the context switching issue.

@bootstraponline
Copy link
Member

Issue appears resolved. If it's still broken, comment and let us know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants