Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
708 views
in Test Planning by
I am automating test cases using Selenium WebDriver. I am currently executing tests using iPhone device. Screen arranges elements based on screensize. I want to know java script command to get widnth of window/htlml document

1 Answer

0 like 0 dislike
by
selected by
 
Best answer

You can try below code:

 

JavascriptExecutor js = (JavascriptExecutor) driver;
Long width = (Long)js.executeScript("return window.innerWidth;");
 


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...