如何在Selenium IDE中自动进行鼠标滚动事件 [英] How to Automate Mouse scrolling event in Selenium IDE
问题描述
我正在尝试捕获/自动执行Selenium IDE中的鼠标滚动事件. 就像在Facebook朋友列表页面中一样,我们必须滚动到末尾以列出所有朋友.
I am trying to capture/automate mouse scrolling event in selenium IDE. Like in Facebook friend list page, we have to scroll to the end to list all friends.
我想使用Selenium IDE自动化该功能.
I want to automate that functionality using Selenium IDE .
我做了什么:
-
使用我当前的脚本,我可以登录Facebook.
with my current script i can log in to Facebook.
然后在标题中单击我的名字,我可以转到我的个人资料 页面.
Then on clicking on my name from the header i can go to my profile page.
在我的个人资料页面上,我正在存储好友数的值, 然后单击朋友链接,我可以转到朋友列表页面.
At my profile page, i am storing the value of number of friends, and then on clicking the friends link i can go to the friend list page.
在使用assert函数的朋友列表页面中,我比较的值 我在上一页中存储的数字朋友,显示的数字 在朋友列表页面上.
At friends list page using assert function i compare the value of number friends which i stored at previous page with the number showing at the friend list page.
我无法执行的操作
- 我想使用命令滚动并比较几个朋友 已经列出了,还有多少,
- I want to scroll using command and compare howmany friend are already listed and how much is remaining ,
如果(保持< 1),那么我将不会进一步滚动
if (remaining <1) then i will not scroll further
否则,我将滚动一段时间,然后再次比较多少 还剩下.
else i will scroll for some amount of time and again compare how much is left.
推荐答案
硒RC:
selenium.getEval("window.scrollBy(x,y)");
Selenium IDE:
Selenium IDE :
storeEval | selenium.browserbot.getCurrentWindow().scrollTo(x,y)
已更新:
<tr>
<td>storeEval</td>
<td>selenium.browserbot.getCurrentWindow().scrollTo(100,800)</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td>10000</td>
</tr>
<tr>
<td>storeEval</td>
<td>selenium.browserbot.getCurrentWindow().scrollTo(200,1600)</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td>10000</td>
</tr>
<tr>
<td>storeEval</td>
<td>selenium.browserbot.getCurrentWindow().scrollTo(300,2400)</td>
<td></td>
</tr>
这会将窗口滚动到3个不同的坐标.
This will scroll the window to 3 different coordinates.
这篇关于如何在Selenium IDE中自动进行鼠标滚动事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!