简体   繁体   English

无法使用Selenium IDE在iFrame中找到任何html元素

[英]Unable to locate any html element in an iFrame with Selenium IDE

I have to make a navigation script with Selenium IDE in an internal web application of my company. 我必须在我公司的内部Web应用程序中使用Selenium IDE制作导航脚本。 The problem is that I need to catch any element on a page that has iFrame and that iFrame has everything in the page (the main body tag, div tags, the form, JS scripts, etc) My Selenium script works well until: 问题是我需要捕获具有iFrame的页面上的任何元素,并且iFrame包含页面中的所有内容(主体标签,div标签,表单,JS脚本等),我的Selenium脚本可以正常工作,直到:

</thead><tbody>
<tr>
  <td>open</td>
  <td>{my URL}</td>
  <td></td>
</tr>
<tr>
 <td>click</td>
 <td>//ul[@id='any ID']/li/a/span</td>
 <td>true</td>
</tr>
<tr>
 <td>waitForElementPresent</td>
 <td>//html/body/iframe</td>
 <td>1000</td>
</tr>
<tr>
 <td>selectFrame</td>
 <td>myFrameID</td>
 <td></td>
</tr>

And when I try to insert any other command as 'assertElementPresent', 'verifyElementPresent', 'assertText', etc, my script fails because Selenium doesn´t find the locator elements. 当我尝试插入任何其他命令作为'assertElementPresent','verifyElementPresent','assertText'等时,我的脚本失败,因为Selenium找不到定位器元素。 I'm using Selenium IDE 2.9.0 and Firefox as browser. 我正在使用Selenium IDE 2.9.0和Firefox作为浏览器。

Does anybody know how to do it?? 有人知道怎么做吗? I need help as soon as possible. 我需要尽快的帮助。

Confirm the xpath by locating it using xpath extension of firebug. 通过使用firebug的xpath扩展来定位xpath,以确认xpath。 that can give you the right location. 可以为您提供正确的位置。

Thanks for your helping, I could solve my doubt about iFrames with Selenium IDE by myself, and I have just made some complex scripts without problems. 感谢您的帮助,我可以自己解决对带有Selenium IDE的iFrame的疑问,并且我编写了一些复杂的脚本,没有出现问题。

Now I have another doubt that I would like to ask you guys: 现在我还有一个疑问,我想问你们:

I have in a JSP page a form and inside this form, when I select an option in a combo another four combos are shown. 我在JSP页面中有一个表单,并且在此表单中,当我在组合中选择一个选项时,会显示另外四个组合。 In my Selenium script I have recorded the Select command when I select in the first combo, and after the other combos have appeared, I have recorded a Click command in another button. 在我的Selenium脚本中,当我在第一个组合中选择时,我记录了Select命令,而在其他组合出现后,我在另一个按钮中记录了Click命令。 But when I execute the script, the Click command is executed before the Select commands in the four combos mentioned above. 但是,当我执行脚本时,在上面提到的四个组合中,单击命令先于选择命令执行。

Why the Click command is executed before the Select command when I play my script?? 播放脚本时,为什么在选择命令之前执行单击命令?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM