Google browser versions for each platform resources

https://chromedriver.storage.googleapis.com/index.html versions of each platform browser Driver Download (official website)

https://npm.taobao.org/mirrors/chromedriver/ versions of each platform browser Driver Download (Ali Mirror)

https://www.chromedownloads.net/chrome64win/ versions of each platform chrom Download

Correspondence between each version of the driver:

 

ChromeDriver Version     Chrome Version
78.0.3904.11         78
77.0.3865.40         77
77.0.3865.10         77
76.0.3809.126         76
76.0.3809.68         76
76.0.3809.25         76
76.0.3809.12         76
75.0.3770.90         75
75.0.3770.8         75
74.0.3729.6         74
73.0.3683.68         73
72.0.3626.69         72
2.46           71-73
2.46           71-73
2.45            70-72
2.44     69-71
2.43     69-71
2.42     68-70
2.41     67-69
2.40     66-68
2.39     66-68
2.38     65-67
2.37     64-66
2.36     63-65
2.35     62-64

 When python test browser with Google, the chromedriver.exe file into the \ Scripts in python installation directory.

In doing reptiles with selenium, the need to use Google or Firefox (CentoOS 7 environment, headless mode)

Install Google Chrome and drive way:

. Step1 rpm package in the official website or download chrome mirror sites, for example: google-chrome-stable_current_x86_64.rpm

. Step2 download the corresponding version of the drive: chromedriver_linux64.zip

. Step3 installation dependencies:

yum install -y lsb
yum install -y libXScrnSaver

yum install libappindicator-gtk3

yum install liberation-fonts

step 4 to install a browser program

rpm -ivh google-chrome-stable_current_x86_64.rpm

Online can also be installed:

yum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

step 5 install the driver. After extracting driver, placed in the directory / usr / local / bin / under to take effect

After installation, test the installation:

google-chrome-stable --headless --disable-gpu --screenshot http://www.baidu.com/

Error:

[1209/235648.782239:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

You need to specify the run in no-sandbox mode.

google-chrome-stable --no-sandbox --headless --disable-gpu --screenshot http://www.baidu.com/

That success shows the following:

[1210/000036.689653:INFO:headless_shell.cc(620)] Written to file screenshot.png.

 In python reptile's program:

Code chrome_options.add_argument () is critical, it is necessary to run in a non-form interface, and second, disable sandbox, otherwise the program error.

# -*- coding: utf-8 -*-
import time
from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless') # 指定无界面形式运行
chrome_options.add_argument('no-sandbox') # 禁止沙盒
driver = webdriver.Chrome(chrome_options=chrome_options)

driver.get('http://www.baidu.com/')
time.sleep(10)
print(driver.page_source) 

driver.close() 
driver.quit() 

 

 

Guess you like

Origin www.cnblogs.com/yoyowin/p/12014014.html