SeleniumBase

Mobile Testing

Use ``--mobile`` to run SeleniumBase tests using Chrome's mobile device emulator with default values for Device Metrics and User-Agent. Here's an example mobile test: [SeleniumBase/examples/test_skype_site.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_skype_site.py) ```bash pytest test_skype_site.py --mobile ``` [](https://seleniumbase.io/cdn/gif/skype_mobile_test_2.gif) To configure Device Metrics, use: ```bash --metrics="CSS_Width,CSS_Height,Pixel_Ratio" ``` To configure the User-Agent, use: ```bash --agent="USER-AGENT-STRING" ``` To find real values for Device Metrics, see: * [Device Metrics List](https://gist.github.com/sidferreira/3f5fad525e99b395d8bd882ee0fd9d00) To find real User-Agent strings, see: * [User Agent Strings List](https://developers.whatismybrowser.com/useragents/explore/) -------- Here's another example of a mobile test: [SeleniumBase/examples/test_swag_labs.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_swag_labs.py) ```bash pytest test_swag_labs.py --mobile ``` [](https://seleniumbase.io/cdn/gif/swag_mobile.gif) Here's an example of configuring mobile settings for that test: ```bash # Run tests using Chrome's mobile device emulator (default settings) pytest test_swag_labs.py --mobile # Run mobile tests specifying CSS Width, CSS Height, and Pixel-Ratio pytest test_swag_labs.py --mobile --metrics="411,731,3" # Run mobile tests specifying the user agent pytest test_swag_labs.py --mobile --agent="Mozilla/5.0 (Linux; Android 9; Pixel 3 XL)" ``` --------

SeleniumBase.io Docs SeleniumBase.io Docs