how to launch URL link in android emulator browser from windows

user2255985 picture user2255985 · Apr 12, 2013 · Viewed 7.7k times · Source

I have question. I want to automate testing in android browser.

My requirements:

I have JS Test Driver maven project which needs to be tested in android browser.

So what I want to do is

in maven pom.xml file instead of pointing to chrome as

<browser.command>C:\Program Files (x86)\Google\Chrome\Application\chrome.exe</browser.command>

Create bat file which will run command that launch URL link in android emulator browser and point it to that bat file.

My problem is I don't know what command to write that will lunch particular URL in android emulator browser from command line.

Any suggestions?

Answer

baske picture baske · Apr 12, 2013

Using the adb shell tool in combination with the am command, you should be able to launch the browser on your Android device, and point it to an url of choice.

Something like (don't have a device with me at the moment, so cannot test):

adb shell am start -a "android.intent.action.VIEW" -d "http://your.url.here"

Put that in your bat-file and run it. It should automatically find a connected device. If you would also like to wait for a device to become available, check the adb documentation: this can also be done.