Using Firefox
-
Install modify-headers plug-in in Firefox.
-
Create new ff profile
-
Set appropriate user-agent in profile
To run using driver (not remote driver):
While running script pass additional system property -Dwebdriver.firefox.profile=<profilename>
or in ant target add <systemproperty name="webdriver.firefox.profile" value="<profilename>">
.
Set property
driver.name=firefoxDriver
To use remote driver
Start selenium server with -Dwebdriver.firefox.profile=<profilename>
Set properties
remote.server="selenium server host ip"
remote.port="port on which selenium server running"
driver.name=firefoxRemoteDriver
Using Chrome
- Provide following property in application.properties file
chrome.additional.capabilities={"chromeOptions":{"mobileEmulation":{"deviceName":"Google Nexus 5"}}}
webdriver.chrome.driver = chromedriver path
driver.name=chromeDriver
- Follow the link for specifying a device from the DevTools Emulation panel as the value for “deviceName”. 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"]}}
Note: Please update path of user-data-dir as per your chrome profile dir.