selenium-free interface operation browser startup items and Chrome Options settings

from Selenium Import the webdriver
 from selenium.webdriver.chrome.options Import the Options
 # instantiate a startup parameter object 
chrome_options = the Options ()
 # Configure boot entry 
chrome_options.add_argument ( ' --headless ' ) # Set no interface mode browser 
chrome_options. (add_argument ' --start-maximized ' ) # set maximized window starts running browser 
chrome_options.add_argument ( ' --incognito ' ) # set trace mode 
chrome_options.add_argument ( ' --disable-infobars ') # Setting disables the browser is being automated process control tips 
chrome_options.add_argument ( ' --window-size = 1928,1080 ' ) # Set the resolution of the browser window size 
# launch the browser 
Driver = webdriver.Chrome (chrome_options = chrome_options ) 
driver.get ( ' http://www.baidu.com ' )

Common startup parameters:

Encoding settings of the browser window size as before:

Use the above options set to start

After encoding settings of the browser window size:

Start your browser window size settings:

driver.maximize_window()

After launching the browser window size settings:

driver.set_window_size(900,600)

Reference documents:

http://www.51testing.com/html/65/n-4461565.html

https://www.cnblogs.com/pywjh/p/9785650.html

Guess you like

Origin www.cnblogs.com/yaoze2018/p/11329869.html