简体   繁体   English

如何在Selenium IDE中自动化鼠标滚动事件

[英]How to Automate Mouse scrolling event in Selenium IDE

I am trying to capture/automate mouse scrolling event in selenium IDE. 我试图在selenium IDE中捕获/自动化鼠标滚动事件。 Like in Facebook friend list page, we have to scroll to the end to list all friends. 就像在Facebook好友列表页面中一样,我们必须滚动到最后才能列出所有朋友。

I want to automate that functionality using Selenium IDE . 我想使用Selenium IDE自动化该功能。

What i have done : 我做了什么 :

  1. with my current script i can log in to Facebook. 用我目前的脚本我可以登录Facebook。

  2. Then on clicking on my name from the header i can go to my profile page. 然后点击标题中的我的名字,我可以转到我的个人资料页面。

  3. 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. 在我的个人资料页面,我正在存储朋友数量的值,然后点击朋友链接我可以转到朋友列表页面。

  4. 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. 在使用断言功能的朋友列表页面中,我将我在前一页面上存储的号码朋友的值与在朋友列表页面上显示的号码进行比较。

What i am not able to do 我无法做到的

  1. I want to scroll using command and compare howmany friend are already listed and how much is remaining , 我想使用命令滚动并比较已经列出的好友以及剩余多少,

if (remaining <1) then i will not scroll further 如果(剩余<1)那么我将不会进一步滚动

else i will scroll for some amount of time and again compare how much is left. 否则我会滚动一段时间并再次比较剩下多少。

Selenium RC : Selenium RC:

selenium.getEval("window.scrollBy(x,y)");

Selenium IDE : Selenium IDE:

storeEval  |  selenium.browserbot.getCurrentWindow().scrollTo(x,y)

UPDATED: 更新:

<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>

This will scroll the window to 3 different coordinates. 这会将窗口滚动到3个不同的坐标。

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

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