HASSAN HAJJAM
HASSAN HAJJAM

Reputation: 61

How do I use Selenium IDE on Firefox to test if a scroll bar is present

Please, I am trying to test a website with selenium ide. Now, i need to check if the scroll bar exists or no, if it doesn't exist i want to stop the test. Using javascript can we make this test with : document.getElementById('page').scrollWidth > window.innerWidth

Upvotes: 1

Views: 171

Answers (1)

Antesser
Antesser

Reputation: 669

You need Selenium IDE flow control to do that

open      | https://en.wikipedia.org/wiki/Special:Random 
storeEval | window.document.documentElement.scrollHeight>window.innerHeight | ${scroll}
gotoIf    | ${scroll} | PASSED
fail_here |
label     | PASSED

It is opening a random page of Wikipedia and fails if there is no vertical scrollbar

UPDATE Even more simple:

verifyEval | window.document.documentElement.scrollHeight>window.innerHeight | true

Upvotes: 1

Related Questions