Follow

How to run mobile web app on desktop browser?

You can run your mobile web app on Firefox as well as on chrome with modify header.

Using Firefox:

  1. First close all of the Firefox instances then create new Firefox profile. Profile can be created by following Use the Profile Manager to create and remove Firefox profiles .
  2. Install Modify Header 
  3. Add user agent string as follows
      • In Firefox, click on the Tools menu, and choose Modify Headers. The Modify Headers dialog appears (it isn’t the most intuitive interface):
      • In the drop-down list at the top-left of the screen, choose Add
      • In the first text box, type 'User agent Name'
      • In the second box, paste in the User Agent Profile URL for the desired mobile device. UA strings can be found here
      • Click the Add button
  4. Now turn on the Modify Headers and Test whether it works by navigating to any mobile website.
  5. Close the browser
  6. To use this profile in automation with QAF, provide webdriver.firefox.profile=<PROFILE_NAME> in application.properties file.
  7. Provide sysproperty in testng task of runtests target in scripts/seleniumtestrunner.xml file as follows.                                               <sysproperty key="webdriver.firefox.profile" value="<PROFILE_NAME>" />

 

 Using Chrome:

1. Provide following property in application.properties file

  • chrome.additional.capabilities={"chromeOptions":{"mobileEmulation":{"deviceName":"Google Nexus 5"}}}
  • webdriver.chrome.driver = D:/chromedriver.exe
  • selenium.defaultBrowser=chromeDriver

2. Follow the link for specifying a device from the DevTools Emulation panel as the value for “deviceName". https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation

 

Another way to run using Chrome :

  1. Create Chrome Profile on which mobile web tests will execute.
  2. Provide following property in application.properties file
    • chrome.additional.capabilities={"chromeOptions":{"args":["user-data-dir=D:/tools/webdriver/chromedriver_win32/mobile"]}}

Note : Please update path of user-data-dir as per your chrome profile dir.

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk