I need to test login using facebook connect on my site. When clicking on connect using facebook button, a pop is open.
I use ie = Watir::Browser.attach(:title, 'Login | Facebook')
to assign this new window to a new object. But somehow it the previous browser object also refrences the new object.
b = Watir::Browser.start( "http://www.pstom.com" )
b.link(:text, "Connect with Facebook").click
irb(main):081:0> puts b.title
PSToM - Home
=> nil
ie = Watir::Browser.attach(:title, 'Login | Facebook')
puts b.title
Login | Facebook
=> nil
irb(main):085:0> puts ie.title
Login | Facebook
=> nil
What is going wrong (I'm testing in IRB in Ubuntu)
I think there was a problem with firewatir gem and attaching. Try the same with watir-webdriver gem (it can drive Firefox).
github: https://github.com/jarib/watir-webdriver
rubygems: https://rubygems.org/gems/watir-webdriver
installation:
https://github.com/zeljkofilipin/watirbook/blob/master/installation-ubuntu.md
https://github.com/zeljkofilipin/watirbook/downloads