Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

how to get width of a browser window using javascript?

Solved 1 Answers 72 Views Test Planning
0 1
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

Best answer

You can try below code:


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

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.