Scroll window horizontally with selenium in Java

Sett 110 ganger
Hopp til første uleste melding

derek...@gmail.com

ulest,
2. mai 2016, 14:48:0702.05.2016
til Selenium Users
Is it possible to scroll the window horizontally by a small margin using selenium code ?

ericb...@gmail.com

ulest,
3. mai 2016, 05:23:0203.05.2016
til Selenium Users
You could do it with the javascript executor.

jsExecutor.executeScript('scroll(1000, 0)');

There's a similar question and answer here: http://forum.testproject.io/index.php?topic=55.0

anemuday

ulest,
3. mai 2016, 07:48:2803.05.2016
til Selenium Users
Hi Derek,

Below is the line of code that will scroll 500 pixels from top.

((JavascriptExecutor) driver).executeScript("window.scrollTo(0, 500)"); 0 is x-coordinate and 500 is y-coordinates from top.

Let us know if it works out.

Thanks,
Uday

anemuday

ulest,
3. mai 2016, 07:58:0303.05.2016
til Selenium Users
Sorry,

You wanted scrolling horizontal right? so you can change x-coordinate to 1000 and y as 0

((JavascriptExecutor) driver).executeScript("window.scrollTo(1000, 0)");

divya

ulest,
19. juni 2017, 04:27:2019.06.2017
til Selenium Users
Hi ,

I am trying to scroll the page down using java Script Executor and the code is as below :


But it doesn't Execute the script Any help is Appreciated.i am Also not sure about the pixel number to be given?



((JavascriptExecutor)driver).executeScript("scroll(0,2000)");.

anemuday

ulest,
20. juni 2017, 03:08:4220.06.2017
til Selenium Users
Divya,

Your screen resolution may not have 2000 y coordinate. Generally x,y coordinates are like 1024 * 768 etc....

Try using scroll with 1000(y-coordinate) or 500 like that.
((JavascriptExecutor)driver).executeScript("scroll(0,1000)");

srividya yanamala

ulest,
16. juli 2017, 08:23:0916.07.2017
til seleniu...@googlegroups.com
Hi ,

I am trying to click on an element and it is located below the page hence using scroll to move it down. the element is getting highlighted but it is not clicked.

1. Tried adding wait and also tried using Actions double click and the is displayed for element says true and I have added enough wait time also .

the xpath for the  same is:
//div[@id='overviewtab_1']//div[@class='row']/div//button[@class='btn btn-primary pull-right btn-sm']

Actually the xpath has many divs like .//*[@id='overviewtab_1']/div/div/div/div/div[2]/div/div/div/div[1]/div/div/button so modified it .

The element is highlighted when run the script but does not click . Can some one help me please.


Thanks,
Srividya.






--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/yg-UUagzAT8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7cc1c38d-8507-44ef-aac2-9507313c07be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Svar alle
Svar til forfatter
Videresend
0 nye meldinger