I am trying the below code to take the control to bottom right of the page but it is not working in my case.
Execute JavaScript | window.scrollTo(900,-900);
I tried other coordinates too, but still no success. Is there any other way to achieve this?
I am trying the below code to take the control to bottom right of the page but it is not working in my case.
Execute JavaScript | window.scrollTo(900,-900);
I tried other coordinates too, but still no success. Is there any other way to achieve this?
Share Improve this question edited Dec 20, 2016 at 13:51 Goralight 2,1076 gold badges27 silver badges43 bronze badges asked Dec 20, 2016 at 13:32 Shoaib AkhtarShoaib Akhtar 1,4035 gold badges20 silver badges46 bronze badges 4- Do you want to handle an element located in bottom right corner? – Andersson Commented Dec 20, 2016 at 14:30
- 1 window.scrollBy(900, 900) worked for me. Don't know why, I guess this should be used to access element on top right most of page, but this is working to access element on bottom right most of page – Shoaib Akhtar Commented Dec 20, 2016 at 14:38
- Removed my ment and created the answer to the problem! – Goralight Commented Dec 20, 2016 at 14:48
-
2
@ShoaibAkhtar,
(0, 0)
is top left corner coordinates (starting point), so the top right probably could be(0, 900)
, bottom left-(900, 0)
...etc. Obviously, none of coordinates could be a negative number – Andersson Commented Dec 20, 2016 at 14:55
1 Answer
Reset to default 5Instead of using
Execute JavaScript | window.scrollTo(900,-900);
Use this instead
Execute JavaScript | window.scrollBy(900, 900);
To help understand, and building on what Andersson said; the way your monitor works its coords is like a reversed graph
You start from the top left, and "add" to the right of the screen and then to the bottom of the screen.
0,0 being top left, and 1920,1080 being bottom right (given that you are using a 1080p monitor)
Any other problems please ask