在Selenium IDE中关闭新打开的选项卡或窗口 [英] Close a newly opened tab or window in Selenium IDE

查看:213
本文介绍了在Selenium IDE中关闭新打开的选项卡或窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Selenium IDE和Windows7和Firefox,自动单击链接可能会产生新的标签或新的窗口.

Using Selenium IDE with Windows7 and Firefox, an automatic click on a link may produce either a new tab or a new window.

close()关闭原始窗口或选项卡,而不关闭新窗口或选项卡.也许如果我拥有新创建的ID,则可以选择它然后将其关闭,但是我不知道如何自动执行此操作.我在Selenium论坛上问过并在这里阅读了问题,但它们集中在WebDriver而不是IDE上.任何帮助将不胜感激!

close() closes the original window or tab, not the new one. Maybe if I had the ID of the newly created one I could select it and then close it but I don't know how to do this automatically. I've asked on the Selenium forum and read the questions here, but they focus on WebDriver, not the IDE. Any help would be appreciated!

 Stig

推荐答案

我遇到了同样的问题并找到了解决方案:

I had same problem and found a solution:

  1. 单击打开新标签页的链接
  2. 添加命令 waitForPopUp
  3. 通过命令 selectPopUp
  4. 将焦点设置到新标签页
  5. 在新标签中对您的内容进行验证或其他命令
  6. 使用命令 close 关闭标签页
  7. 使用命令 selectWindow 将焦点设置到旧窗口
  1. click on link that opens the new tab
  2. add command waitForPopUp
  3. set focus to new tab via command selectPopUp
  4. make your verifications or other commands regarding to your content in new tab
  5. use command close to close tab
  6. use command selectWindow to set focus to the old window

我的Selenium IDE命令的屏幕截图:

Screenshot of my Selenium IDE commands:

对我有用.

这篇关于在Selenium IDE中关闭新打开的选项卡或窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆