Playback on mobile browser
Since Sahi uses a proxy and injects Javascript, Sahi scripts can run on most mobile browsers.Pre-requisites
- The Mobile device and System on which Sahi Pro is running should be on the same network.
- Find the IP of the laptop (using ipconfig on Windows). We will call it the
laptopIP
- Configure the proxy settings on the device with proxy host
laptopIP
and Sahi port9999
danger USE ONLY ONE OF THE METHODS TO SET PROXY, DO NOT USE BOTH.a) Run below commands in the command prompt (this will set proxy globaly and takes effect right away):- To set proxy in Android device/emulator:
Eg.adb shell settings put global http_proxy <host>:<port>
adb shell settings put global http_proxy 10.10.2.50:9999
- To check proxy of Android device/emulator:
To disable proxy in Android device/emulator:adb shell settings get global http_proxy
adb shell settings put global http_proxy :0
b) Alternetive way to set proxy in Android device/emulator are below:
- To set proxy in Android device/emulator:
- Turn off the mobile data.
- Go to Settings > Network & internet > wi-fi > (AndroidWifi) settings > Edit > Advanced options > Proxy > Select the Manual Proxy.
- Configure Proxy.
- After setting the proxy, please turn off the wi-fi and turn on again to reflect the proxy.
- Go to Settings > Wireless & networks > Cellular networks > Access Point Names > (create)Sahi_Proxy.
- Configure APN.
APN:localhost.sahitest.com
proxy host:laptopIP from previous step
proxy port:9999
infoThis method will not work if the device is using any VPN service.
For Android device/emulator
having version 8 and above,
Android emulator only
having version 7 and below,
Run From Mobile Device
- Start Sahi on a laptop that is on the same network as the mobile device.
- On the mobile browser, navigate to
http://laptopIP:9999/
. eg.http://10.10.2.50:9999/
- This will open a screen which looks like this:
-
For automating HTTPS websites in mobile browsers, Sahi's root certificate must be installed.
Below are the steps to install Sahi's root certificate:-
For Android 11 and above version,
- click on the
crt
order
links to download Sahi's root certificate. - open Settings.
- Go to Biometrics/Security > Other security settings/Credential Storage (depend on devices) > Install certificates from storage > CA Certificate.
- Accept the warning alert.
- Browse to the downloaded certificate and select it.
- Confirm the certificate installation.
- click on the
crt
order
links to download the Sahi's root certificate. - open the downloaded file (if not open automatically) and proceed to the certificate installation process.
infoNote: In order to open SSL websites in iOS device, turn on SSL trust for Sahi root certificate. Go toSettings
→General
→About
→Certificate Trust Settings
. UnderEnable full trust for root certificates
, enable trust for the certificate. - click on the
- Ensure that cookies are allowed in the mobile browser settings.
- Set the File, Start URL and click "Run" to run the script
Run Android Browser Script From Sahi Pro Editor
warning
Please ignore the
step 1
to step 5
for Android Device which is not tethered with the system or for Android Emulator and ensure that USB debugging is enabled in the android device/emulator and ADB is available on the system. Refer here for more details.
- Install Sahi Pro Mobile Web Runner on the device.
- Launch the application on the device.
- Configure the proxy host and port in the application and Click on
Connect
. - You will prompt to allow
Screen Cast
. Click onStart Now
. - Once the application is connected to Sahi Pro,
connection established
message will be shown on the application. - Open Sahi Pro Editor and select a script to execute on the Android browser.
- Click on
Playback
. - Select
Android Browser
asStart Mode
. - Select
Android device
. - Set
Start URL
. - Click on
Run
.
- Click on
infoNote: For SSL websites, open Sahi pro launcher page by clicking on
Open Sahi Pro Launcher
from the application.
Then click on the crt or der links to download and install the Sahi root certificate.
Run iOS Browser Script From Sahi Pro Editor
- Follow the
step 1
tostep 5
from Run From Mobile Device. - Open Sahi Pro Editor and select a script to execute on the iOS browser.
- Click on
Playback
. - Select
iOS Browser
asStart Mode
. - Select device which contains
Remote
as part of device name asiOS device
. - Set
Start URL
. - Click on
Run
.