5.7 How to automate mobile web using Opkey?
Introduction
OpKey allows its users to automate responsive mobile websites. By using OpKey Chrome Recorder (Chrome Addon), you can easily record actions performed on your responsive website showing in mobile view.
Once the test script has been created successfully, you can play it back on the locally connected Android or iOS device by using Appium Plugin. Furthermore, if you want to execute this Test Case on the pCloudy device then you need to add this Test Case to a Suite and then execute that Suite on the pCloudy device by using Appium plugin.
Steps to be followed:
- Create a Test Case and then click on the Record button and then select the Web Recorder.
- Select the Default Object Repository or Choose Object Repository & then select Chrome Addon.
- If Chrome Addon extension is not integrated with your Chrome Browser then Get Extension button will get enabled.
- Click on the Get Extension button to integrate Chrome Addon with your Chrome Browser.
- Once Chrome Addon gets integrated with your Chrome Browser then click on the Start Recording button to proceed.
- Chrome Addon and Chrome Web Browser get opened here.
- Right click on the browser and then select Inspect option.
- Click on the Toggle Device Toolbar button as shown button to switch your responsive website in Mobile Chrome browser view.
- Here, your responsive website gets opened in the mobile view in Chrome browser.
- Start performing your actions on the website.
- Actions being performed on the website are getting recorded one by one with object properties.
- Once the recording session gets completed, click on the Stop and Save to stop recording session and save the recorded actions with objects.
- Have a look at the Test Case created through recording using Chrome Addon Recorder.
Execution on locally connected Android/iOS Device:
- Now, if you want to execute this Test Case on the locally connected Android device then add a new test step with keyword LaunchChromeOnMobile by unchecking/skip to run OpenBrowser test step.
- Select LaunchChromeOnMobile keyword, click on the Input Data tab and then select the registered and connected device with your local machine as AndroidDevice and enter URL of your website.
- Make sure that the mobile device is registered and connected with your machine. For details, please refer: Mobile Management
- Now, if you want to execute this Test Case on the locally connected iOS device then add a new test step with keyword LaunchSafariOn_iOS by unchecking/skip to run OpenBrowser test step.
- Select LaunchSafariOn_iOS keyword, click on the Input Data tab and then select the registered and connected device with your local machine as AndroidDevice and enter URL of your website
- Make sure that the mobile device is registered and connected with your machine. For details, please refer: Mobile Management
- Click on the Run Now button. Fill required fields in Local Execution Wizard, select your online Agent and Appium plugin and click on the Next.
- Once the execution gets completed, have a look at the execution result.
Execution on pCloudy Android/iOS Device:
The created Test Case can also be executed on the supported cloud-based devices like pCloudy. If you want to execute it on a pCloudy device then you need to make few changes.
- In case you want to execute your Test Case on an Android device on pCloudy then add a new test step with keyword LaunchChromeOnMobile by unchecking/skip to run OpenBrowser test step.
- Select LaunchChromeOnMobile keyword, click on the Input Data tab and then select the Global Variable tab and then select Default Mobile device as AndroidDevice and enter URL of your website.
- In case you want to execute your Test Case on an iOS device on pCloudy then add a new test step with keyword LaunchSafariOn_iOS by unchecking/skip to run OpenBrowser test step.
- Select LaunchChromeOnMobile keyword, click on the Input Data tab and then select the Global Variable tab and then select Default Mobile Device as AndroidDevice and enter URL of your website.
- Create a new Suite and add that Test Case in it and Save it.
- Click on the Run on pCloudy button.
- Login with your valid pCloudy credentials (API User Name and API Access Key) and click on Log In.
- Fill required fields in pCloudy Execution Wizard, select online Agent & Appium plugin.
- Select Show Advanced Settings checkbox and click on the Next.
- You can apply advanced execution settings from here, as shown. Click on Next to proceed.
- From here, you can add Session Tags. Click Next to proceed.
- From here, you can select a Global Variable. Click Next to proceed.
- From here, select Android, its version and an Android device from the list.
- Click Next to proceed.
- Here, you can have a look at the selected Android OS version and android device.
- Click Complete to start test execution.
- Test execution is getting started.
- Test execution has finished. Have a look at the execution result.