Webdriver Sampler : How can we scroll through application up and down using scripting

1,868 views
Skip to first unread message

Akshay Pachkhede

unread,
Dec 19, 2014, 3:00:23 AM12/19/14
to jmeter-...@googlegroups.com
Hi

I want to understand the way if we can scroll the application up and down using webdriver sampler commands.
For Example :
1.User is on Youtube home Page.
2.User wants to scroll down to view another video's.

Is it possible to do so using Webdriver Sampler??

Thanks

gli...@gmail.com

unread,
Dec 20, 2014, 6:22:51 AM12/20/14
to jmeter-...@googlegroups.com
You can use WDS.browser.executeScript() function which is a shorthand to JavascriptExecutor.executeScript() virtual method. 

The following code should help:

WDS.browser.get('http://youtube.com')
WDS.browser.executeScript('window.scrollTo(0, 250);')

You may also wish to maximize browser window

WDS.browser.manage().window().maximize()

JavaScript Window object scrollTo() method takes 2 arguments: first is X axis (horizontal) position, second one is Y axis (vertical) position so window.scrollTo(0, 250) line will scroll 250 pixels down. 

For more WebDriver Sampler tips and tricks refer to The WebDriver Sampler: Your Top 10 Questions Answered guide.  

sohel...@gmail.com

unread,
Mar 25, 2019, 7:10:14 AM3/25/19
to jmeter-plugins
//Element to find during the scroll
var element = WDS.browser.findElement(org.openqa.selenium.By.xpath("//span[@class='mat-button-wrapper'][text()='Login']"));
 // Scroll until that element is not appeared on page. 
WDS.browser.executeScript("arguments[0].scrollIntoView(true);",element);

Raghavan

unread,
Mar 27, 2019, 7:44:26 PM3/27/19
to jmeter-...@googlegroups.com
Web driver sampler. 

What are the best practices? 

Can we match the web driver sampler results with the browser load times ? 

What can we measure / cannot using web sampler? 

What is the best approach for scripting  - directly in Jmeter Web sampler or script using IDE and import to Jmeter ? 

Thank you. 
--
You received this message because you are subscribed to the Google Groups "jmeter-plugins" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jmeter-plugins+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks,
Raghavan
Reply all
Reply to author
Forward
0 new messages