Automated tests running on actual android devices (Chrome and ChromeDriver)

119 views
Skip to first unread message

Chris Young

unread,
Oct 28, 2014, 12:28:30 PM10/28/14
to chromedri...@googlegroups.com
Hello,

I'm just getting started using selenium to automate web apps on mobile devices. I've successfully set up selenium's webdriver and, using selendroid, I was able to run a test on an actual Android device (Nexus 7) through Android Browser.
So, that's great, but what I want to do is run a test on the actual device using Chrome. I'm running into trouble using chromedriver. I'm using the example given here (Python):

from selenium import webdriver
capabilities = {'androidPackage': 'com.android.chrome', 'androidDeviceSerial': myDevicesSerialNumber}
driver = webdriver.Remote('http://localhost:9515', capabilities)
driver.get('http://google.com')
driver.quit()

I think what I need to do is change the webdriver.Remote addrress to point to the IP:port of the Nexus.
When I do that, I get an error message that the device refused the connection (which is given by urllib2).

My question(s) is/are:

1. Is it possible to drive automated tests using selenium and/or chromedriver on a real device using chrome (or other browsers - not the android browser).
2. If so, am I on the right track with getting an actual browser running on a real android device (not emulator or emulated in Chrome on desktop).

I've searched extensively and haven't been able to find any info that doesn't pertain to emulation.

Thanks!



Chris Young

unread,
Oct 28, 2014, 3:22:44 PM10/28/14
to chromedri...@googlegroups.com
never mind. had the chromeOptions wrong...

--
You received this message because you are subscribed to a topic in the Google Groups "ChromeDriver Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/chromedriver-users/HwFq2SC7mfY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to chromedriver-us...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

PeterJeffreyGale

unread,
Nov 19, 2014, 6:02:34 AM11/19/14
to chromedri...@googlegroups.com
Interesting ... what settings did you use in the end?

Chris Young

unread,
Nov 19, 2014, 9:28:44 AM11/19/14
to PeterJeffreyGale, chromedri...@googlegroups.com
Hi Peter,

It's rather embarrassing, actually (a friend of mine said 'looks like you forgot the semi-colon' as a way to point out my mistake. Funny guy).

So, the settings were fine, I just didn't specify in capabilities that these were chrome options. So, should look like below (apologies for formatting, relevant part in bold). It was just adding 'chromeOptions' to the dictionary. :/ 
You can add the device serial number if needed, but I'm only running one Nexus 4 right now, so it's not needed here:

from selenium import webdriver
capabilities = {'chromeOptions': {'androidPackage': 'com.android.chrome'}}

driver = webdriver.Remote('http://localhost:9515', capabilities)
driver.get('http://google.com')
driver.quit()

Thanks,

Chris

On Wed, Nov 19, 2014 at 5:02 AM, PeterJeffreyGale <peterjef...@gmail.com> wrote:
Interesting ... what settings did you use in the end?

--

PeterJeffreyGale

unread,
Nov 19, 2014, 10:26:19 AM11/19/14
to chromedri...@googlegroups.com
Thanks!

nka...@payoff.com

unread,
Aug 25, 2015, 12:38:46 AM8/25/15
to ChromeDriver Users
On Wednesday, November 19, 2014 at 7:26:19 AM UTC-8, PeterJeffreyGale wrote:
> Thanks!

Hi Chris & Peter,

I am running the ChromeDriver tests on Samsung S5 Device. Sometimes, when I run the test, I get an error Device not found, whereas the device is connected and adb is recognizing it. This has usually happened in the following scenarios:

- I abruptly end the test execution.
- Or if the test execution fails because of some Element Not found error etc.

Reply all
Reply to author
Forward
0 new messages