I want to access the data in a popup window containing a login form, this window opens when you click on a logo, this line contains the code to execute the javascript: <div id="loadDIV" class="containerLogo" onclick="ventanaSecundaria('/Security-war/autentia/Login.jsp?sion=c5ac379249711c18cf6e030c8400',800,600); "></div>
with this line run the script: browser = browser.div(:class => "containerLogo").fire_event :click
watir open in a new popup form. The problem is that I can not access the data from the popup window and need to fill the form containing, try the following: puts browser.text.include? 'Login'
puts browser.text.include? 'Login'
and get false, then I thought that maybe I could not access the other popup and look for something to not open another window but only refresh the I'm using and so we can access its contents, looking I found that I can do this: browser.goto("javascript:document.getElementByClass()'containerLogo').click()")
but I try to console returns 'true' and the browser does not update.
Update You can switch windows simply with this: browser.window(:index => 1).use
and to be sure we change verify the url window with this:
browser.window.url
When a new browser window is opened, you can then 'use' the new window. [Browser Popups | Watir Webdriver]
browser.window(:title => "annoying popup").use do
browser.button(:id => "close").click
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.