Python selenium whether to launch a browser interface to perform

There are interface runs:

# Import library 
from the Selenium Import webdriver 

# have interface 
# to open the Google browser session is established. Start Chromedriver.exe open Chrome 
Driver = webdriver.Chrome ()       # start the Google browser 
# to access Baidu Home 
driver.get ( " http://www.baidu.com " )

No interface runs

# Import library 
from the Selenium Import webdriver 

# no interface 
chrome_options = webdriver.ChromeOptions () 
chrome_options.add_argument ( ' --headless ' ) 
Driver = webdriver.Chrome (chrome_options = chrome_options) 

# access Baidu Home 
driver.get ( " HTTP: // www.baidu.com " )
 Print ( " finished " )

 

 

******* Please respect the original, as to reprint, please indicate the source: Reprinted from: HTTPS: //www.cnblogs.com/shouhu/ , thank you! ! ******* 

Guess you like

Origin www.cnblogs.com/shouhu/p/12191430.html