Hello Folks,
In this post, we will see an interesting scenario .
When we open a website and scroll down, suddenly a button appears, which says “Click me anytime if you want to go on top again”. An example is given below:
You need to verify functionality of Back To Top button using selenium webdriver.
We will use a JavaScript command to get scroll height. Example program is below:
If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappySelenium
Hello!
if rezult:
Default scroll height: 0
Current scroll height after scrolling: 0
Current scroll height after clicking on back to top button: 0
What the reason could be?
Hi, i need your help i have one query as below,
How to automate graphs through selenium webdriver.
If you can locate elements in graph, you can automate otherwise no.
Good one!!
There should be an if condition to validate whether the test was successful or not. Something like
Assert.assertEquals(defaultScroll, currentScrollHeightAfterClickingOnBackToTop);
then only we can say if our test was successful or not. otherwise its just scroll testing
A suggestion could you please before the code mention steps you are going to perform. like previously you shared explanation in detail.
Thanks Gaurav. Will take care of feedback.
This is amazing Amod! Very helpful post.
Thanks Vibhor.