You can run your mobile web app on Firefox as well as on chrome with modify header.
Using Firefox:
- 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
- Install Modify Header
-
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
-
- Now turn on the Modify Headers and Test whether it works by navigating to any mobile website.
- Close the browser
- To use this profile in automation with QAF, provide webdriver.firefox.profile=<PROFILE_NAME> in application.properties file.
- 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
driver.name=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 :
Create Chrome Profile on which mobile web tests will execute.
Provide following property in application.properties file
chrome.additional.capabilities={"chromeOptions":{"args":["user-data-dir=D:/tools/webdriver/chromedriver_win32/mobile"]}}