Browser automation on a mobile device?

Hello,

Most of our clients require us to test the mobile version of their web sites. We were wondering if it’s possible or if it’s in the works to automate browsers on mobile devices?

Thanks for the tip, will give it a try! :slight_smile:

Oh wow, that’s quite awesome! I suppose it will be a bit tricky since the xpath of elements will probably not be the same on the desktop and mobile version of the site, but i will give it a go.

Do you have any suggestions and tips on how to most easily adapt a desktop-recorded web test to run on a mobile device?

So a test script recorded on a desktop can be directly executed on a mobile device, nothing special required? Not even the chrome plugin? Katalon will run the browser on the device, go to the required site and execute the steps inside the mobile browser?

Yes, we have Android and iOS devices that we use to manually test the mobile version of the clients’ sites.

But we would like to automate these “mobile web” tests, just like normal aumated web (desktop) tests, but they have to run on a mobile device instead. Is that possible?

1 Like

Hi there,

The xpath will not be different between a real web browser and mobile web browser. They should be the same in all cases :slight_smile:

My only suggestions related to your scenario is you can utilize ‘mobileEmulation’ options in Chrome. It simulates the same device screen and behaviors when you execute your test script on Chrome web browser.

Example

Settings: http://prnt.sc/f0o5f7 => Execution result: http://prnt.sc/f0o63y

Hi Dobromir,

Yes that’s right. Of course Chrome application (on Android device) and Safari application ( on iOS device) must be installed on the device so that execution can happen properly.

Thanks

Hi there,

Yes you can do that. Execute the same test script and select either ‘Android’ or ‘iOS’ item accordingly.

Thanks

Hi there,

Do you have any mobile devices available from your side? If so then you need to connect your device into your machine and then execute your test scripts in connected device :slight_smile:

Thanks

Hi guys,
I tried the settings mentioned for @Vinh Nguyen on the custom settings for ‘mobileEmulation’ , but so far has not work at all. It still running the test cases on normal web browser, any ideas what else should i configure in order to run it on any browser emulation device from chrome?

Hi there,

The xpath will not be different between a real web browser and mobile web browser. They should be the same in all cases :slight_smile:

My only suggestions related to your scenario is you can utilize ‘mobileEmulation’ options in Chrome. It simulates the same device screen and behaviors when you execute your test script on Chrome web browser.

Example

Settings: Screenshot by Lightshot => Execution result: Screenshot by Lightshot

anahi galuba-garcia said:

Hi guys,

I tried the settings mentioned for @Vinh Nguyen on the custom settings for ‘mobileEmulation’ , but so far has not work at all. It still running the test cases on normal web browser, any ideas what else should i configure in order to run it on any browser emulation device from chrome?

Hi there,

The xpath will not be different between a real web browser and mobile web browser. They should be the same in all cases :slight_smile:

My only suggestions related to your scenario is you can utilize ‘mobileEmulation’ options in Chrome. It simulates the same device screen and behaviors when you execute your test script on Chrome web browser.

Example

Settings: http://prnt.sc/f0o5f7 => Execution result: http://prnt.sc/f0o63y

Hi,

I did manage to get this working.

The screenshots from Vinh Nguyen are admittedly vague, but the information is available in the ChromeDriver docs Sign in - Google Accounts

I set it up like this:

Driver name:
Chrome

Inside the Preferences field apply the following:
Name=mobileEmulation
Type=Dictionary
Inside the Value field apply the following:
Name: deviceName
Value Type: String
Value: your chrome device name (‘iPhone 6’ in my case)

see link: Chrome DevTools - Chrome for Developers

2 Likes

I’m trying to solve a similar problem, ie. leverage Katalon to test a responsive web app across devices. For certain use-cases, our web app detects what client the user is on and if it detects a phone it displays information differently than it does if the client is a tablet or desktop browser. When the client is a desktop browser (Chrome) in phone emulation mode, our code still detects it as a desktop browser. My hope was that Katalon offered a phone emulator (or maybe Kobiton) that our code would detect as an actual phone so we can test our custom phone experience.

Vinh Nguyen said:

Hi there,

The xpath will not be different between a real web browser and mobile web browser. They should be the same in all cases :slight_smile:

My only suggestions related to your scenario is you can utilize ‘mobileEmulation’ options in Chrome. It simulates the same device screen and behaviors when you execute your test script on Chrome web browser.

Example

Settings: http://prnt.sc/f0o5f7 => Execution result: http://prnt.sc/f0o63y

hay vinh nguyen

i want to ask how to set the size of this emulation , how to set width and height of this cause its always run in 100% zoom and i want to decrease it

wait for your answer very soon

Dear mate,

I am able to put emulation in place, but how to do that for landscape mode for any device., Please the attached settings that i have done, but no succcess. Please help configuring it.

Please elaborate more about the test and also the settings. Based on your screenshots, issues happen in both test execution and on record/spy session, so which is the real issue you need assistant?

Hi Vinh,

Goal: automate mobile webversion of website. So i want to create script in landscape mode and run that on browser stack. So how to do that?

I tried that but I get next error:

05-22-2019 01:28:40 PM openBrowser(“https://www.fly-go.it/”)

Elapsed time: 1.910s

05-22-2019 01:33:26 PM Test Cases/3.Mobile_Flight/1.FlyGoIT/Online/1.SearchFlight/1.FlightSearchIT

Elapsed time: 2.558s

Test Cases/3.Mobile_Flight/1.FlyGoIT/Online/1.SearchFlight/1.FlightSearchIT FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to open browser with url: ‘’
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:60)
at 1.FlightSearchIT.run(1.FlightSearchIT:28)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:133)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:116)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:83)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at TempTestSuite1558521204321.run(TempTestSuite1558521204321.groovy:35)
Caused by: org.openqa.selenium.InvalidArgumentException: invalid argument: cannot parse capability: goog:chromeOptions
from invalid argument: cannot parse mobileEmulation
from invalid argument: ‘deviceName’ must be used alone
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17763 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 55 milliseconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘FLYGO-TESTING’, ip: ‘192.168.56.1’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: driver.version: CChromeDriver
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:20)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:147)
at com.kms.katalon.selenium.driver.CChromeDriver.(CChromeDriver.java:13)
at com.kms.katalon.core.webui.driver.DriverFactory.createNewChromeDriver(DriverFactory.java:281)
at com.kms.katalon.core.webui.driver.DriverFactory.startNewBrowser(DriverFactory.java:243)
at com.kms.katalon.core.webui.driver.DriverFactory.openWebDriver(DriverFactory.java:188)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.doCall(OpenBrowserKeyword.groovy:74)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.call(OpenBrowserKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
… 17 more

Hi all , is there any update regarding this issue ? I just try to create script desktop on katalon and want to run that using mobile web browser. It already succeeded open the link on browser mobile web but when go to next step click (WebUI.click) it took really long time and FAILED in the end cause cannot found the xpath.

Can someone share their experience and how to solve this problem ?

@nandatiarninda There must be a problem with the xpath, Use Chrome mobile emulation to test your xpath if it is working in your case

Hi all,

Can some one please help me how to run a WebUI test case already written in a Mobile device. Say android device?

Thank you