I am using the following code to right-click on a link and open the target 
in a new tab in FireFox.

profile = Selenium::WebDriver::Firefox::Profile.new
profile.native_events = false

caps = Selenium::WebDriver::Remote::Capabilities.firefox(:native_events => 
false)
driver = Selenium::WebDriver.for(:firefox, profile: profile, 
desired_capabilities: caps)
agent = Watir::Browser.new(driver)
agent.goto 'http://www.google.com'

link = agent.a(:class => 'gb_ib')
agent.driver.action.context_click(link.wd).send_keys(:arrow_down).send_keys(:return).perform
puts agent.windows.count
puts agent.windows.last.title
agent.windows.last.use

It works fine, except that Watir does not seem to recognize the newly 
opened tab. The new tab gets opened, and I would expect the 
"agent.window.last.use" command to change the focus to that new tab. 
However, it does not.

In fact, printing out the number of windows results in 1 and the title of 
that page is "Google".

How can I make Watir recognize that I have opened a new tab in this manner?

Thanks!

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to