Mac下用selenium启动Chrome浏览器问题解决

之前在mac的Python shell中,无法通过driver=webdriver.Chrome()启动谷歌浏览器。现解决方法如下:

(前提:Chromedriver在/usr/local/bin/目录下)

from selenium import webdriver
browser = webdriver.Chrome(executable_path="/usr/local/bin/chromedriver")

或:

from selenium import webdriver
path = "/usr/local/bin/chromedriver"
driver = webdriver.Chrome(path)

或:

from selenium import webdriver
driver = webdriver.Chrome("/usr/local/bin/chromedriver")

原文地址:https://www.cnblogs.com/gonghongwei/p/9404484.html

时间: 2024-07-30 10:40:07

Mac下用selenium启动Chrome浏览器问题解决的相关文章

早上在linux下用selenium启动Chrome时出现问题:

早上在linux下用selenium启动Chrome时出现问题:报错: Traceback (most recent call last): File "get2.py", line 62, in <module> browser = webdriver.Chrome() File "/root/.pyenv/versions/anaconda3-5.1.0/lib/python3.6/site-packages/selenium/webdriver/chrome

MAC下使用Wireshark调试chrome浏览器的HTTP/2流量

1.设置环境变量 mkdir ~/tls && touch ~/tls/sslkeylog.log #zsh echo "\nexport SSLKEYLOGFILE=~/tls/sslkeylog.log" >> ~/.zshrc && source ~/.zshrc #bash echo "\nexport SSLKEYLOGFILE=~/tls/sslkeylog.log" >> ~/.bash_prof

用selenium启动chrome浏览器

python 3.7 pycharm 1.安装selenium pip3 install selenium 2.下载与chrome匹配的chromdriver.exe,放到项目的解释器路径下,跟python.exe同一个路径 随笔最后附上匹配列表和下载链接 注:如果chromedriver.exe与chrome不匹配,启动会出现各种错误,比如启动不了,或者启动后不能正常访问网址 3.程序: from selenium import webdriver from time import sleep

selenium启动Chrome时,加载用户配置文件

selenium启动Chrome时,加载用户配置文件 Selenium操作浏览器是不加载任何配置的,网上找了半天,关于Firefox加载配置的多点,Chrome资料很少,下面是关于加载Chrome配置的方法: 一.加载所有Chrome配置 用Chrome地址栏输入chrome://version/,查看自己的“个人资料路径”,然后在浏览器启动时,调用这个配置文件,代码如下: #coding=utf-8 from selenium import webdriver option = webdriv

【python爬虫】利用selenium和Chrome浏览器进行自动化网页搜索与浏览

功能简介:利用利用selenium和Chrome浏览器,让其自动打开百度页面,并设置为每页显示50条,接着在百度的搜索框中输入selenium,进行查询.然后再打开的页面中选中“Selenium - 开源中国社区”,并打开页面 知识简介: selenium的作用: 1).最初用于网站自动化测试,近几年,用于获取精确的网站快照. 2).可以直接运行在浏览器上,让浏览器自动加载页面,获取需要的数据,还可以页面截屏,或者判断网站上某些动作是否发生. 项目步骤: 1.利用google的Chrome浏览器

selenium启动chrome出错处理:Message: &#39;chromedriver&#39; executable needs to be in PATH

selenium启动chrome出错处理:Message: 'chromedriver' executable needs to be in PATH

mac下的virtualbox启动失败处理

不知从哪个版本开始,mac下的virtualbox建立vm以后,启动就提示什么驱动没有加载,google后,解决如下 sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart mac下的virtualbox启动失败处理

windows下使用Wireshark调试chrome浏览器的HTTP/2流量

1.在Wireshark官网(https://www.wireshark.org/#download)下载对应的Wireshark安装包,进行安装 2.增加系统环境变量设置(计算机 -- 右键 -- 属性--高级系统设置--高级--环境变量--系统变量--新建) 变量名:SSLKEYLOGFILE 变量值:%USERPROFILE%\sslkeysENV.pms 3.在CMD使用命令行启动chrome浏览器 > "C:\Program Files (x86)\Google\Chrome\A

selenium与chrome浏览器及驱动的版本匹配

用selenium+python+webdriver完成UI功能自动化,经常会碰到浏览器版本与驱动的版本不匹配而引起报错,下面就selenium与chrome浏览器及驱动的版本匹配 做个总结. 使用WebDriver在Chrome浏览器上进行测试时,需要先下载与本机chrome浏览器对应的驱动程序,驱动程序名为chromedriver:chromedriver的版本需要和本机的chrome浏览器对应,才能正常使用,具体步骤如下: 第一步:下载对应版本的chromedriver驱动文件,具体版本请