Configuring chrome + selenium centos

Reference material

https://blog.csdn.net/wkb342814892/article/details/81591394

 

1. Install chrome-browser

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm --no-check-certificate 
sudo yum install google-chrome-stable_current_x86_64.rpm

2. Installation chromedriver: an interactive interface for chrome and

yum install chromedriver

3. Install selenium

pip install selenium

 

Test Case

from the Selenium Import webdriver
 from selenium.webdriver.chrome.options Import Options 

chrome_options = Options () 
chrome_options.add_argument ( ' --headless ' ) # 16 years later, the solution chrome given robbed PhantomJS jobs 
chrome_options.add_argument ( ' GPU---disable ' ) 
chrome_options.add_argument ( ' --no-Sandbox ' ) # root user without this will not work 

Driver = webdriver.Chrome (chrome_options = chrome_options)
 for i in the Range ( 10 ): 
    . Driver GET ( 'https://www.baidu.com/ " ) 
    Print (driver.title) 
driver.close () 
# normal output is 10 ," Baidu, you know . "

 

Guess you like

Origin www.cnblogs.com/erhao9767/p/11369876.html