102

How can I start a browser with the adb shell command and make it open a certain web page?

Alex P.
  • 28,775
  • 16
  • 113
  • 160
Shrikant Tudavekar
  • 1,309
  • 3
  • 11
  • 6

6 Answers6

247

Running this command will start a web browser in android:

adb shell am start -a android.intent.action.VIEW -d http://www.stackoverflow.com
RzR
  • 2,952
  • 27
  • 25
Joakim Lundborg
  • 10,440
  • 6
  • 30
  • 39
58

If your url's are symbol heavy you should also quote aggressively

adb shell am start -a android.intent.action.VIEW -d 'http://stackoverflow.com/?uid=isme\&debug=true'
Daniel Imms
  • 45,529
  • 17
  • 143
  • 160
ash_jungroup
  • 639
  • 5
  • 3
6

If you want to start Chrome specifically

adb shell am start \
-n com.android.chrome/com.google.android.apps.chrome.Main \
-a android.intent.action.VIEW -d 'file:///sdcard/lazer.html'

Also give Chrome access to sdcard via

adb shell pm grant com.android.chrome android.permission.READ_EXTERNAL_STORAGE

Swap com.android.chrome with com.chrome.canary if you are using Chrome canary version.

auselen
  • 26,672
  • 5
  • 70
  • 110
4

I wanted to start silk on my kindle via adb, without adding a new url. I came up with this:

adb shell am start -n com.amazon.cloud9/.browsing.BrowserActivity
Daniel Imms
  • 45,529
  • 17
  • 143
  • 160
Bobbi Bennett
  • 1,626
  • 1
  • 11
  • 13
0

You can open the default web browser with keyevents too (it's possible to write KEYCODE_EXPLORER instead of 64)

adb shell input keyevent 64

Enter an url submit: (66 -> KEYCODE_ENTER)

adb shell input text "stackoverflow.com" && adb shell input keyevent 66
kubano
  • 575
  • 5
  • 10
0

I add --user 0 after start and work in jackpal emulator like this:

adb shell am start --user 0 -a android.intent.action.VIEW -d http://www.stackoverflow.com

Stephen Ostermiller
  • 21,408
  • 12
  • 81
  • 104