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

Accessing popup windows #35

Open
mmrobins opened this issue May 25, 2012 · 13 comments
Open

Accessing popup windows #35

mmrobins opened this issue May 25, 2012 · 13 comments

Comments

@mmrobins
Copy link

A fairly common practice in authentication of Twitter apps via OAuth is to redirect to the authorize endpoint in a popup window. I'm not able to use Selenium to fully test because it doesn't handle redirects (AFAIK), but mechanize doesn't handle popup windows

main, popup = page.driver.browser.window_handles
within_window(popup) do
  # fill in login info here and click authorize 
end

Any suggestions on how to handle this or if it would be possible to add window handling to capybara-mechanize? Thanks.

@ryansch
Copy link
Contributor

ryansch commented Jan 17, 2014

I believe this has been fixed since the 1.0 release.

@phillbaker
Copy link
Owner

No kidding? @ryansch thanks for helping to clear out the backlog. I'll try to add a test for this.

@brunobrgs
Copy link

Does it work?

page.driver.browser.window_handles (version 1.4.0)

undefined method 'window_handles ' for #Capybara::Mechanize::Browser

@ryansch
Copy link
Contributor

ryansch commented Nov 12, 2014

It worked as of the 1.1.0 release with capybara 2.1.0. Sounds like we might have a regression.

@brunobrgs
Copy link

I will try like you said, thanks

@brunobrgs
Copy link

@ryansch For this, the method window_handles should be here, on 1.1.0.

https://github.com/jeroenvandijk/capybara-mechanize/blob/v1.1.0/lib/capybara/mechanize/browser.rb

or not?

@ryansch
Copy link
Contributor

ryansch commented Nov 12, 2014

Not there. Notice how the class inherits from Capybara::RackTest::Browser? That should lead you to it.

@ryansch
Copy link
Contributor

ryansch commented Nov 12, 2014

I'm assuming this broke due to changes in Capybara.

@brunobrgs
Copy link

I'm saying this, because when i use capybara-webkit, it works.

At master there, the method exist: https://github.com/thoughtbot/capybara-webkit/blob/c1b501ca525532d261ded8d3c0c6408716a1f8ef/lib/capybara/webkit/browser.rb#L129

@ryansch
Copy link
Contributor

ryansch commented Nov 12, 2014

Right they wrote their own browser. Capybara-mechanize is a special kind of racktest driver.

I'm interested in that deprecation warning. I'm fairly certain that's the real cause of this issue.
What version of capybara are you running?

@brunobrgs
Copy link

With webkit:
gem 'capybara', '2.1.0'
gem 'capybara-webkit', '1.0.0'

With mechanize i tried, but didn't work:
gem 'capybara', '2.1.0'
gem 'capybara-mechanize', '1.1.0'

@ryansch
Copy link
Contributor

ryansch commented Nov 12, 2014

Something strange is going on then. We're using the second stanza in our app right now and we make pretty heavy use of page.driver.browser.window_handles.

@brunobrgs
Copy link

I will try again, will check it outside my app, maybe it is a something else, then i come back here.
Thank you.

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

No branches or pull requests

4 participants