вторник, 22 октября 2013 г.

How To Generate Mouse Scrolling Event Using Selenium IDE With Example Tutorial

Many tutorial post are available for selenium IDE Mouse related commandsbut 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
CommandTargetValue
store40i
store0looptimes
whilestoredVars.looptimes <= 20
storeEvalselenium.browserbot.getCurrentWindow().scrollTo(0,${i})
storejavascript{storedVars.looptimes++;}
storeEval${i}+40i
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.
  • 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.

Комментариев нет:

Отправить комментарий