Many tutorial post are available for selenium IDE Mouse related commands but mouse scrolling event was missing from them till now. You need mouse scrolling event when you are testing software application like Facebook. In Facebook, post are loaded on mouse scrolling if you have seen. In this kind of scenario,
you need to generate mouse scrolling event in selenium IDE.
Let me give you an example. First of all open one page which contains vertical scroll bar(long description page) and then run bellow test case in selenium IDE.
New Test | ||
Command | Target | Value |
store | 40 | i |
store | 0 | looptimes |
while | storedVars.looptimes <= 20 | |
storeEval | selenium.browserbot. getCurrentWindow().scrollTo(0,${i}) | |
store | javascript{storedVars.looptimes++;} | |
storeEval | ${i}+40 | i |
endWhile |
(Note : You need to attache user-extension.js file with selenium IDE to get support of "while" command in selenium IDE. Click here to view steps of downloading and installing user-extension.js file with selenium IDE.)
When you run above script in selenium IDE, it will scroll your page vertically if scroll bar is there on page.
When you run above script in selenium IDE, it will scroll your page vertically if scroll bar is there on page.
- You can change while loop value from '20' to your choice depending on length of page. If page is lengthy then increase that value.
- 'selenium.browserbot.getCurrentWindow().scrollTo(0,${i})' is used with "storeEval" command for generating scroll event on page using selenium IDE. If you want to generate scroll event on horizontal scroll bar then use ''selenium.browserbot.getCurrentWindow().scrollTo(${i},0)''. It will create horizontal scrolling event on software web application page.
- In above script you can change ${i}+40 --> ${i}+60 to increase or ${i}+40 --> ${i}+20 to decrease scrolling speed.
Very informative
ReplyDeleteGud one ,, thankx
ReplyDeleteHow to use this on a pop up window? I have a pop up menu with scroll bar.
ReplyDeletewhat should i do?
Please reply.
arjunps22@gmail.com
How to use this facility on a pop up menu? I have a pop up menu with scroll bar.
ReplyDeletePlease reply what should i do.
arjunps22@gmail.com
when i run above test case selenium IDE troughs [error] Unknown command: 'While' above error
ReplyDeleteDowload the "user-extensions.js" and then in selenium IDE goto Options->Options and under the "selenium core extensions" type the path of "user-extensions.js"
Deletehey. i am testing a website and clicking on a button, after that i get an error of "unexpected alert". Can you tell me how to handle such unexpected alerts using selenium ide?
ReplyDeleteYou can do It using storeAlertPresent and gotoif command. Send me your example link by filling form given on bellow URL.
Deletehttp://software-testing-tutorials-automation.blogspot.com/p/request-free.html.
Hey, thanks pretty much good informative blog.
ReplyDeleteWhile loop command with js, it help me lot.
when i run above test case selenium IDE troughs [error] Unknown command: 'While' above error
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi! I tried this running the code above but my scrollbar would only move once. The loop executed without error. What could be the problem?
ReplyDeletepls help me anyone,In my project use the two calender start date or end date but they select one calender value and calender is not close .pls tell me
ReplyDelete