MobileWeb Automation

1- MobileWeb automation on Android devices

 

  1. Create an Android project with any dummy APK file.

  2. Open Android Project Settings. Use these capabilities in the project. Our example browser is a Chrome browser

    • appPackage → String → com.android.chrome

    • appActivity → String → com.google.android.apps.chrome.Main

    • autoGrantPermissions → Boolean → true

    • autoWebview → Boolean → false

  3. Open Recorder with any Android device. Start to record your scenarios.

Here there is an example of Javascript Mocha code for skipping Chrome tutorial and opening the URL.

 

//SKIP Welcome return driver .waitForElementByXPath("//*[@text = 'Accept & continue']") .click() .sleep(3000) .waitForElementByXPath("//*[@text = 'Next']",5000) .click() .sleep(3000) .waitForElementByXPath("//*[@text = 'No thanks']",5000) .click() .sleep(5000); //Open URL return driver .waitForElementByXPath("//*[@text = 'Search or type web address']",5000) .click() .sleep(1000) .waitForElementByXPath("//*[@text = 'Search or type web address']",5000) .sendKeys("www.mobven.com") .sleep(1000) .waitForElementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/androidx.recyclerview.widget.RecyclerView/android.view.ViewGroup[1]/android.view.ViewGroup/android.widget.LinearLayout/android.widget.TextView[1]",5000) .click() .sleep(5000); //YOUR CODE let element_11 = await driver.elementByAccessibilityId("Menu"); await element_11.click(); return driver.sleep(2000);

Run your Android test

2- MobileWeb automation on iOS devices

 

Use bundleId Capability for iOS MobileWeb automation. Our testing browser is Safari in this article.

  1. Create an iOS project with any dummy IPA file.

  2. Open iOS Project Settings. Use this capability in the project. Our example browser is the Safari browser

    • bundleId → String → com.apple.mobilesafari

  3. Open Recorder with any iOS device. Start to record your scenarios.

 

Example Javascript Mocha test code:

let element_13 = await driver.elementById("URL"); await element_13.click(); await element_13.sendKeys("https://www.mobven.com/"); let element_27 = await driver.elementById("Go"); await element_27.click(); return driver.sleep(5000);

 

More information about automating mobile web apps:

https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/mobile-web.md