Skip to content

Commit 0aad1d9

Browse files
committed
Add Android documentation
1 parent 3948cdb commit 0aad1d9

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ filebeat-etc.yml
7070
filebeat.yaml
7171
_hp/asis/
7272
trees/
73-
pre_*.ipynb
73+
pre_*.ipynb
74+
nohup.out

README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,32 @@ export DISPLAY=:99 && fluxbox -log fluxbox.log &
6464
### Mobile Browsers (Android)
6565
- Execute `cd _hp/hp/tools/crawler`
6666
- To run the tests on Android devices, first some emulators have to be set up and the browsers have to be installed and configured:
67-
- TODO: include all info here (Tin)
68-
- Emulator Setup (install adb, setup emulator, ...)
69-
- Browser Installation and Setup
70-
- Additional browser config (popups need to be allowed):
71-
- Chrome: By default, Pop-ups and redirects are blocked. To allow, go to Settings/Site Settings/ Turn on the Pop-Ups and Redirects option
72-
- Brave: By default, the pop-ups are blocked by the Privacy Shields setting. To enable, go to Settings/Brave Shields & privacy/ Allow all trackers and ads
73-
- To allow popups, to go about:config, and then set dom.disable_open_during_load to false.
67+
- Download the Android SDK Command-Line Tools (command line tools only) form the Android Studio downloads page and unpack it in a folder called `AndroidSDK` (see https://developer.android.com/tools/sdkmanager).
68+
- Add `cmdline-tools` to the path: e.g., `export PATH=<path-to-AndroidSDK>/cmdline-tools/latest/bin/:$PATH`
69+
- Install `platform-tools` and `emulator`: `sdkmanager platform-tools emulator`
70+
- Add `platform-tools` to the path: e.g., `export PATH=<path-to-AndroidSDK>/platform-tools/:$PATH`
71+
- Add `emulator` to the path: e.g., `export PATH=<path-to-AndroidSDK/emulator/:$PATH`
72+
- Install and create a Pixel 3 Device with Android 11 installed:
73+
- Run `sdkmanager --install "platforms;android-30" "system-images;android-30;google_apis;x86_64`
74+
- Run `avdmanager create avd -n device_1 -k "system-images;android-30;google_apis;x86_64" --device "pixel_3" --force`
75+
- Install `scrcpy` to be able to interact with the Android Device: `apt install scrcpy`
76+
- Browser Installation and Setup:
77+
- Start the emulator: `emulator @device_1 -screen multi-touch -no-window -port 5554&`
78+
- Attach with `scrcpy`
79+
- Setup required browsers:
80+
- Download the corresponding APKs:
81+
- Chrome: https://www.apkmirror.com/apk/google-inc/chrome/chrome-121-0-6167-180-release/ (x86 APK)
82+
- Brave: https://www.apkmirror.com/apk/brave-software/brave-browser/brave-browser-1-62-165-release/ (x86 APK)
83+
- Firefox Beta: https://www.apkmirror.com/apk/mozilla/firefox-beta/firefox-beta-123-0b9-release/ (universal APK)
84+
- Install the APKs:
85+
- Run `adb -s emulator-5554 install -r -g <path to apk>` for all three APKs
86+
- Additional browser config (popups need to be allowed):
87+
- Open all browsers and go through their setup screen, then allow popups in all of them:
88+
- Open chrome: By default, Pop-ups and redirects are blocked. To allow, go to `Settings/Site Settings/ Turn on the Pop-Ups and Redirects option`
89+
- Open brave: By default, Pop-ups and redirects are blocked. To allow, go to `Settings/Site Settings/ Turn on the Pop-Ups and Redirects option`
90+
- Open firefox_beta: To allow popups, go to `about:config`, and then set `dom.disable_open_during_load` to false.
91+
- Stop the emulator: `adb -s emulator-5554 emu kill`
92+
- @Tin check if all the info here is accurate/correct
7493
- The emulators also need to be able to reach the Header Testing server.
7594
- Issue: currently does not work with the self-signed certs, make sure to have correct certs setup
7695
- Full run:

_hp/hp/tools/crawler/android_intent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def main(browser_list, url_dict, repeat_times, num_devices, resp_type, auto_rest
315315
ap.add_argument('-browsers', '--browsers', dest='browsers', type=str, required=True, nargs='+', choices=browser_list)
316316
ap.add_argument('-url_json', '--url_json', default='', type=str, help='Optional path to a json list of create_repeat.py tests')
317317
ap.add_argument('-repeat', '--repeat', default=1, type=int, help='Repeat each test x times.')
318-
ap.add_argument('-num_devices', '--num_devices', dest='num_devices', type=int, help='How many emulators to start/use')
318+
ap.add_argument('-num_devices', '--num_devices', dest='num_devices', default=1, type=int, help='How many emulators to start/use')
319319
ap.add_argument('-type', '--resp_type', choices=['basic', 'debug', 'parsing'], default='basic', help='Specify the response type (default: basic)')
320320
ap.add_argument('-auto_restart', action='store_true', help='Automatically restart the emulator every 100 URLs.')
321321

0 commit comments

Comments
 (0)