Selenium - AJAX 对话框 - 如何在其中滚动?

发布于 2024-10-09 02:10:01 字数 312 浏览 0 评论 0原文

我正在使用 Selenium IDE 来测试 Web 应用程序。一个页面创建一个简单的 jQuery 对话框,其中包含一些额外的内容。对话框具有固定的高度,并且经常需要垂直向下滚动以显示额外的内容。

无论如何,有没有办法让 Selenium 滚动此对话框,以便查看某个元素? (滚动到对话框底部也是一种解决方案)

我正在使用 Selenium IDE 1.0.10

尽管 selenium 测试在没有滚动的情况下仍然可以工作,但我们会在构建过程中自动运行测试。如果出现错误,我们会截屏以帮助调试。如果测试可以滚动,那么这将使屏幕截图更有价值。

I am using Selenium IDE to test a web application. One page creates a simple jQuery Dialog with some extra content in there. The dialog has a fixed height and frequently there is a need to scroll down vertically to show the extra content.

Is there anyway to get Selenium to scroll this dialog box so that a certain element is in view? (scrolling to the bottom of the dialog would also be a solution)

I am using Selenium IDE 1.0.10

Although the selenium test still works without the scrolling, we automatically run the tests as part of our build process. If there's an error we take a screen shot, to aid debugging. If the test could scroll then this would make the screenshot much more valuable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心欲静而疯不止 2024-10-16 02:10:01

您已经尝试过类似的方法了吗?:

 <tr>
    <td>waitForPopUp</td>
    <td>popupID</td>
    <td></td>
</tr>
<tr>
    <td>selectPopUp</td>
    <td>popupID</td>
    <td></td>
</tr>
<tr>
    <td>windowFocus</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>runScript</td>
    <td></td>
    <td>selenium.browserbot.getCurrentWindow().scrollTo(300,200)</td>
</tr>
<tr>
    <td>captureEntirePageScreenshot</td>
    <td></td>
    <td></td>
</tr>

Have you tried out something along these lines already?:

 <tr>
    <td>waitForPopUp</td>
    <td>popupID</td>
    <td></td>
</tr>
<tr>
    <td>selectPopUp</td>
    <td>popupID</td>
    <td></td>
</tr>
<tr>
    <td>windowFocus</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>runScript</td>
    <td></td>
    <td>selenium.browserbot.getCurrentWindow().scrollTo(300,200)</td>
</tr>
<tr>
    <td>captureEntirePageScreenshot</td>
    <td></td>
    <td></td>
</tr>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文