简体   繁体   English

Selenium IDE:在弹出窗口中调用javascript时出现问题

[英]Selenium IDE: problems calling javascript from within a pop-up

I am having problems testing a pop-up menu in Selenium IDE. 我在Selenium IDE中测试弹出菜单时遇到问题。

Within the pop-up there is a button that calls a JavaScript function (that updates a list )and closes the pop-up. 在弹出窗口中,有一个按钮调用JavaScript函数(更新列表)并关闭弹出窗口。

The test will click on the button but the JavaScript function doesn't get called and the pop-up doesn't close. 测试将单击按钮,但不会调用JavaScript函数,并且不会关闭弹出窗口。

If I double click the command myself it works, If spilt the test in two (having the button click in a different case) and run them separately it works 如果我自己双击该命令,它将起作用;如果将测试一分为二(在不同情况下单击按钮),然后分别运行它们,则它将起作用

Has anyone encountered this problem before and explain what is happening? 之前有人遇到过这个问题并解释发生了什么吗?

verifyElementPresent | //td[2]/a/img | |
click | //td[2]/a/img | |
waitForPopUp | lookup | 30000 |
selectWindow | name=lookup | |
click | Checkbox1 | |
click | //table[@id='Table2']/tbody/tr/td[1]/a/img | | 

I have solved the problem myself, simply get the element by tag name and use the runSrcipt command! 我已经解决了这个问题,只需通过标签名称获取元素并使用runSrcipt命令即可!

|verifyElementPresent | //td[2]/a/img | |
|click | //td[2]/a/img | |
|waitForPopUp | lookup | 30000 |
|selectWindow | name=lookup | |
|click | Checkbox1 | |
|storeEval | selenium.browserbot.getCurrentWindow().document.getElementsByTagName('a')[3]|test |
|echo | ${test} | |
|echo: javascript:save();
|runScript | ${test} | |
|close | |  

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

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