[英]Is there a way to use watir to open a link in a new tab or window in firefox
I have a web application I am automating with watir. 我有一个Web应用程序,我正在使用watir进行自动化。 The application has a browsing page which shows thumbnails for a set of templates. 该应用程序有一个浏览页面,显示一组模板的缩略图。 Each thumbnail is a link to the template. 每个缩略图都是指向模板的链接。 I need to open each template in a new tab or window and take a screen shot or print a pdf of the template to verify that it opens correctly and looks correct. 我需要在新的选项卡或窗口中打开每个模板并拍摄屏幕截图或打印模板的pdf以验证它是否正确打开并且看起来正确。 Then close that tab or window and return to the template browser to open the next template. 然后关闭该选项卡或窗口并返回到模板浏览器以打开下一个模板。 I need to do this on firefox/safari chrome and IE mac and windows. 我需要在firefox / safari chrome和IE mac和windows上执行此操作。
Why not open it in the same tab, take the sreenshot, then go back? 为什么不在相同的标签中打开它,拍摄sreenshot,然后回去?
I haven't used Watir, only Selenium, but it looks like Watir has a back
method as well. 我没有使用Watir,只使用了Selenium,但看起来Watir也有back
方法。 If not, you can probably store the URL of the page with the thumbnails and then open it directly by URL. 如果没有,您可以使用缩略图存储页面的URL,然后通过URL直接打开它。
您可以阅读链接的URL,将其存储在变量中,打开一个新的浏览器窗口,然后使用ie.goto(url)
您可以在新的浏览器中打开该链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.