我有一个网站只能在支持Webkit的浏览器(谷歌浏览器,Safari)中呈现.我使用的是谷歌浏览器,因为我使用的是Windows 7.
我正在使用Watir-WebDriver进行自动化.
问题:当我单击浏览器窗口上的按钮时,将启动另一个窗口,并在新的浏览器窗口中呈现发布单击内容.我需要一种能够识别这个新浏览器窗口的方法,以便能够继续我的测试.我一直在各种论坛上阅读,但没有得到任何确定的答案/解决方案.
问:对于watir-webdriver,是否有替代watir :: ie.attach,因为Watir-Webdriver不支持附加
示例代码:
require "rubygems"
require "watir-webdriver"
require "selenium-webdriver"
b = Watir::Browser.new(:chrome)
website = "http://xyz.com"
#a new browser is launched and the website is opened
b.goto(website)
#this opens a new browser window
b.link(:xpath,"/html/body/div/ul/li/a").click
#there is a button called "MAP" on the new browser window
b.link(:id,"btn_MAP")
#this gives an error, unknown link
Run Code Online (Sandbox Code Playgroud) google-chrome webdriver browser-automation watir watir-webdriver