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.
I intend to open it with a specific device selected, like so -
All suggestions and inputs appreciated! Thank you in advance!