How to Scroll to that Element in Jmeter

825 views
Skip to first unread message

payal sharma

unread,
Aug 23, 2016, 3:21:25 AM8/23/16
to Selenium Users

Hi There,
Greeting of the Day.!!!!
I am writing scripts in J meter 3.0 its a good Experience so far.
But I have stuck to one thing now for which I am fighting for solution.
With Fire fox it works fine, but when I am trying to run Same Scripts on Chrome I got an Issue that Scrolling of UI doesn't happen in Chrome the way it works for Fire fox. So for Chrome we need to add Code to Scroll the UI to that Element

I have Used two approaches:

1.) Action Class

var act = JavaImporter(org.openqa.selenium.interactions.Actions)
var builder = new act.Actions(WDS.browser) 
builder.moveToElement(WDS.browser.findElement(pkg.By.xpath("//input[@id='submit_btn']"))).perform();
WDS.log.info("Performed Done")
builder.click();
WDS.log.info("Clicking Done");

This Sampler gave no Syntax Error and it Successfully Printed "Clicking Done"(So I am assuming above Lines executed fine)

But on the UI , nothing happened

2.) Java Executor
var je = js.((JavascriptExecutor) WDS.browser)
var je = new js.((JavascriptExecutor) WDS.browser)
je.executeScript("arguments[0].scrollIntoView(true);", WDS.browser.findElement(pkg.By.xpath("//input[@id='submit_btn']")));

This too gave Error for second Line (var je = new js.((JavascriptExecutor) WDS.browser))

ERROR - com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler: sun.org.mozilla.javascript.internal.EvaluatorException: missing ) in parenthetical (<Unknown source>#12) in <Unknown source> at line number 12

It would be great If you guys can help me out with this

Thanks in Advance !!!!!!

Regards,
Payal Sharma
(Software Tester @ Hughes Systique)

payal sharma

unread,
Aug 23, 2016, 3:22:01 AM8/23/16
to Selenium Users

Hi There,
Greeting of the Day.!!!!

I am writing scripts in J meter 3.0 using Selenium + Java

sohel hasan

unread,
Mar 25, 2019, 7:30:34 AM3/25/19
to Selenium Users
//Element to find upon the scroll-Scroll until you find this element
var element = WDS.browser.findElement(org.openqa.selenium.By.xpath("///span[@class='mat-button-wrapper'][text()='Login']"));

 // Scroll until that element is appeared on the page. 
WDS.browser.executeScript("arguments[0].scrollIntoView(true);",element);
Reply all
Reply to author
Forward
0 new messages