Complete the code to create a ChromeOptions object.
from selenium.webdriver.chrome.options import ChromeOptions options = [1]()
The ChromeOptions class is used to set options for Chrome browser in Selenium.
Complete the code to add the argument to start Chrome maximized.
options = ChromeOptions()
options.add_argument([1])The argument '--start-maximized' tells Chrome to open maximized.
Fix the error in the code to set the experimental option to disable automation info bar.
options = ChromeOptions() options.add_experimental_option('excludeSwitches', [1])
The excludeSwitches option expects a list of strings. Using a list with 'enable-automation' disables the info bar.
Fill both blanks to create a Firefox profile and set it in FirefoxOptions.
from selenium.webdriver.firefox.options import FirefoxOptions from selenium.webdriver.firefox.firefox_profile import FirefoxProfile profile = FirefoxProfile() options = FirefoxOptions() options.[1] = profile browser = webdriver.Firefox(options=options, [2]=profile)
The profile attribute of FirefoxOptions is set to the FirefoxProfile object. The firefox_profile parameter is passed to the Firefox driver.
Fill all three blanks to create ChromeOptions, add headless argument, and set window size.
options = ChromeOptions() options.add_argument([1]) options.add_argument([2]) driver = webdriver.Chrome(options=options) # Verify window size is set to 1920x1080 size = driver.get_window_size() assert size['width'] == [3] and size['height'] == 1080
Use '--headless=new' for modern headless mode, set window size with '--window-size=1920,1080', and check width as integer 1920.