3

My current code is this -

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys

options = webdriver.ChromeOptions()
mobile_emulation = { "deviceName": "iPhone X" } #Specifying device
options.add_argument("start-maximized")
options.add_argument("--auto-open-devtools-for-tabs")
options.add_experimental_option("mobileEmulation", mobile_emulation) #For mobile
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=options, executable_path=r'/Users/amigo/Documents/pet_projects/selenium/chromedriver')
driver.get("https://google.com")

This opens chrome like so - Note that the Toggle Mobile Device tab (next to Elements) isn't activated, and it opens in responsive mode by default.

enter image description here

I intend to open it with a specific device selected, like so -

enter image description here

All suggestions and inputs appreciated! Thank you in advance!

KRW4
  • 57
  • 8
  • 2
    Does this answer your question? [How can I control Chromedriver open window size?](https://stackoverflow.com/questions/23381324/how-can-i-control-chromedriver-open-window-size) – Roqux Dec 18 '19 at 20:25
  • 1
    This is should be an answer to your question. https://stackoverflow.com/questions/37319027/how-to-use-webdriver-mobile-web-on-desktop-browser – IPolnik Dec 18 '19 at 20:41
  • Why do you want to? – DMart Dec 18 '19 at 20:51

0 Answers0