Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add google chrome device emulation recipe to docs #110

Merged
merged 1 commit into from
Jan 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/reference/supported-browsers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,50 @@ To use Google Chrome headless, use::
...


Google Chrome Device Emulation
******************************

To enable device emulation mode with Google Chrome, you can use::

from arsenic import services, browsers, get_session

service = services.Chromedriver()

device_metrics = dict(width=640, height=480, pixelRatio=1.0)

mobile_emulation = dict(deviceMetrics=device_metrics)

kwargs = {'goog:chromeOptions': dict(mobileEmulation=mobile_emulation)}

browser = browsers.Chrome(**kwargs)

async with get_session(service, browser) as session:
...


Google Chrome Device Emulation And Headless
*******************************************

To enable device emulation mode and headless mode at the same time with Google Chrome, you can use::


from arsenic import services, browsers

service = services.Chromedriver(binary='chromedriver')

device_metrics = dict(width=640, height=480, pixelRatio=1.0)

mobile_emulation = dict(deviceMetrics=device_metrics)

args=['--headless', '--disable-gpu']
kwargs = {'goog:chromeOptions': dict(mobileEmulation=mobile_emulation, args=args)}

browser = browsers.Chrome(**kwargs)

async with get_session(service, browser) as session:
...


Headless Firefox
****************

Expand Down