Mobile Web testing on Android 8.0 and Chrome 61

Mobile Web testing on Android 8.0 and Chrome 61

Why Chrome?

With the emulators running on older Android versions, the default Android browser was available, and also the Android browser was also included in the real mobile devices running on older Android versions. With the arrival of the newer Android versions the Android browser hasn’t been actively supported, but on the other hand Chrome is actively updated, and is compatible with the latest Android version. Another reason to choose Chrome is due to the fact that it is used as default browser in the Android emulator, and various mobile devices.

In this post I’m going to talk about how to configure the Android emulator, Chrome, and Appium in order to run the automation tests for the mobile website.

Preparation

In this section I’m going to cover the steps for configuring the appium chrome driver, and the chrome browser in the emulator.

If you have installed Appium, first we need to determine the current version of the installed Appium Chrome driver. In order to achieve this you can use the following command:

cd ~/node_modules/appium-chromedriver/chromedriver/mac/
./chromedriver –version

The result should be the following:

Currently this is the latest version of the chrome driver. If you are running an older version of the Appium Chrome driver, you would have to update it, in order to be compatible with Chrome 61. This could be achieved by using the following commands:

npm uninstall appium-chromedriver
npm install appium-chromedriver –chromedriver_version=2.33

Almost there, next what we are going to setup is the Chrome version on the Android emulator. If you have setup the Android emulator 8.0 you have noticed that the Chrome version is 58. If you try to install newer version of chrome through ADB, you are going to encounter an error message that the application is already installed. If you try to uninstall Chrome from your emulator you are going to notice that this is not possible since Chrome is installed as system application.

In order to uninstall system application from your emulator, we need to start the emulator in writable mode. The emulator could be started in writable mode by using the following command:

./emulator -avd Automation -writable-system

Wait for the emulator to be launched, and once the emulator is launched open another terminal, and add the following commands:

cd ~/Android/sdk/platform-tools/
./adb root
./adb remount
./adb shell
cd system
cd app
rm Chrome -f -rR

Once you have executed the following steps, close the current Terminal session, open new Terminal session, and run the following commands:

cd ~/Android/sdk/platform-tools/
./adb remount
./adb shell
cd data
cd data
rm -r com.android.chrome

If the emulator was successfully run in writable mode, the Chrome application is uninstalled. In order for the commands to take effect the emulator should be restarted. The first set of commands were used to uninstall the chrome application, and the second set of commands were used to uninstall the chrome data from the emulator. In order for the commands to take effect the Android emulator has to be restarted, you can restart the Android emulator by long pressing the power button of the emulator and clicking Restart.

Don’t worry if the emulator takes a bit longer to launch, this is only for the first time after the system application has been uninstalled. Before we install the newer Chrome version you should open Settings -> Apps & notifications -> App info, and verify that the Chrome application is not available.

Next we need to install newer version of chrome. The installation is going to be done by adb, but first we need to download the chrome .apk file. You can download the chrome .apk through the following link, when choosing the chrome version you should choose Android 7.0+ version, and the arm architecture of your emulator.

Once you have downloaded the chrome .apk, copy the chrome.apk file and paste it in the platform-tools folder inside the Android sdk. Before installing chrome, rename the .apk file into chrome_61.apk, this way it would be easier when writing the commands. Once you have done that execute the following command:

./adb install chrome_61.apk

Now open Settings -> Apps & notifications -> App info and navigate to the bottom to check the chrome version. The result should be the following:

Before running the automation tests make sure that Chrome can be opened in the emulator manually, if the application is crashing that means you have downloaded the wrong .apk file. In this case you should choose different .apk file according to the emulator architecture type, and you should repeat the same step for installing the Chrome application.

 

On the gif below it is described the final output when the automation solution is run using Appium, Android and Chrome.

If you want to test the combination of Android 8.0.0 and Chrome 61, you can download the following demo automation suite, and see the results for yourself. And if you are interested into the details of the demo you can check the following post.

Final Thoughts

From the steps above you should be able to setup your own automation environment for Mobile Web testing using Android 8.0.0 and Chrome 61. Thanks for reading this post, and if you find this post useful don’t forget to share it with your friends 😉

One thought on “Mobile Web testing on Android 8.0 and Chrome 61

  1. Pingback: Testing Bits – 10/22/17 – 10/28/17 | Testing Curator Blog

Leave a Reply

Your email address will not be published. Required fields are marked *