老师您好, 我碰到一个问题, 尝试了一会没能解决, 麻烦您了,
在不加入chrome_options 能够调起chrome 并且展示页面, 加入后无法调起chrome
环境配置
mac 10.14.5
Python 3.7.3
Scrapy 1.6.0
selenium 3.141.0
chrome 75.0.3770.80
chrmoeDriver 75.0.3770.8
chromedirver 地址 /Users/baymax/Downloads/chromedriver
chrmoe 地址 /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
不加入参数 chrome_options, 能够正常调起chrmoe 展示内容

加入参数 chrome_options 调起失败, 提示 DeprecationWarning: use options instead of chrome_options
代码
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_option = Options()
chrome_option.add_argument("--disable-extensions")
chrome_option.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
browser = webdriver.Chrome(executable_path='/Users/baymax/Downloads/chromedriver', chrome_options=chrome_option)
browser.get('https://www.zhihu.com/signin')


将chrome_options 换成 options 后, chrome 没有被调起, 等待一段时间后 控制台报错, 进程中存在 chrmoedirver

之后尝试端口换成 10187 等等 一样的错误, 已确定端口未被使用
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:9222
from chrome not reachable
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:10187
from chrome not reachable
其中在命令行中 执行可以调起chrome 并且访问到json内容
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222


麻烦老师 大家帮我下 , 卡在这里了
带你彻底掌握Scrapy,用Django+Elasticsearch搭建搜索引擎
了解课程