junche4 / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
0 stars 0 forks source link

how to identify if page has scrollbar, using Selenium VBA #135

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Operating system :
.Net Framework version :
Office Version :
SeleniumWrapper version :

What is your issue ?
how can we identify if page has a scroll bar. currently i am using 
selenium.executeScript ("if ($(document).width()>$(window).width()) 
alert('horizontal scroll bar')")

but i would like to enable a flag when horizontal scroll bar is observed. can 
we enable a flag(declared as public variable of selenium vBA) through 
javascript?

Or do we have any better solution than using if 
($(document).width()>$(window).width())?

Original issue reported on code.google.com by santhosh...@gmail.com on 6 Feb 2015 at 8:50

GoogleCodeExporter commented 9 years ago
It not possible to set a script variable through Javascript as the architecture 
doesn't allow it.
You can therefore set the script variable with the returned result from the 
executed Javascript:

Dim flag as Boolean
flag = selenium.executeScript("return $(document).width()>$(window).width();")

Original comment by florentbr on 6 Feb 2015 at 9:23

GoogleCodeExporter commented 9 years ago
Thanks florentbr, your solution is very helpful. 

Original comment by santhosh...@gmail.com on 6 Feb 2015 at 10:32