Android Screen Size

108 views
Skip to first unread message

Ben White

unread,
Dec 3, 2013, 1:50:08 PM12/3/13
to seleniu...@googlegroups.com
Is there a way to get the screensize of an Android device running Selenium Webdriver in Python?

I tried using driver.get_window_size() but received a "Window handling not supported on Android" exception.

I am aware of driver.execute_script("document.body.scrollHeight;") but I don't know how to get get that output in my python script.

Any ideas?

Ben White

unread,
Dec 3, 2013, 2:04:11 PM12/3/13
to seleniu...@googlegroups.com
Sorry, the second code snippet was supposed to be driver.execute_script("document.documentElement.clientHeight;"), although I would also like to be able to get the page height.

Ben White

unread,
Dec 6, 2013, 2:28:54 PM12/6/13
to seleniu...@googlegroups.com
So I guess to clarify, is there a way to get the return value of driver.execute_script() so I can grab the screen size and page size? Or is there some alternate method for grabbing these I'm missing in the API?

Krishnan Mahadevan

unread,
Dec 12, 2013, 6:47:39 AM12/12/13
to Selenium Users
You mean something like this : [ In Java]

String userAgent = (String) driver.executeScript("return navigator.userAgent;");


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/589bcd50-1e96-4678-95fd-e860b9a5e53c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jianting Li

unread,
Jan 9, 2014, 12:00:54 AM1/9/14
to seleniu...@googlegroups.com
print driver.get_window_size() can get window wieth and height

在 2013年12月4日星期三UTC+8上午2时50分08秒,Ben White写道:
Reply all
Reply to author
Forward
0 new messages