1、配置虚拟环境
(1)查看当前python版本
系统默认python2,已经安装了python3
(2)安装虚拟环境
https://blog.csdn.net/Diana_Z/article/details/89489927
效果非常完美,没有报错,棒棒哒
2、配置chromedricer
(1)安装google浏览器
https://blog.csdn.net/Diana_Z/article/details/89474991
(2)安装driver
https://blog.csdn.net/Diana_Z/article/details/89468491
(3)报错1
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 4.15.0-45-generic x86_64)
解决方法
https://blog.csdn.net/zhangpeterx/article/details/83502641
我参考这个方法,添加了参数“–no-sandbox”参数是让Chrome在root权限下跑
然后,并没有什么变化,我的chrom浏览器任旧无法启动