Time for action – using the Android driver
In this section we are going to be looking at running some tests against an Android device or emulator. This should be a fairly simple change to our test, but there are a couple of things that we need to do right before the test runs.
- Open a command prompt or terminal.
- We need to start the server. We can do this by touching the app or we can do this from the command line with the following command:
adb -s <serialId> shell am start -a android.intent.action.MAIN -n org.openqa.selenium.android.app/.MainActivity
- We now need to forward all the HTTP traffic to the device or emulator. This means that all the JSON Wire Protocol calls, that we learnt earlier, go to the device. We do it with:
adb -s <serialId> forward ...