带铬金丝雀(python)的Splnter selenium无头
我可以使用selenium和Chrome Canary驱动无头浏览器。 但我不能用Splinter让它工作 提前谢谢 以下是有效的方法带铬金丝雀(python)的Splnter selenium无头,python,google-chrome,selenium,splinter,Python,Google Chrome,Selenium,Splinter,我可以使用selenium和Chrome Canary驱动无头浏览器。 但我不能用Splinter让它工作 提前谢谢 以下是有效的方法 import os from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options chrome_options = Options() chr
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.binary_location = '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'
driver = webdriver.Chrome(executable_path='/usr/local/bin/chromedriver', chrome_options=chrome_options)
以下是不起作用的:
from splinter import Browser
executable_path = {'executable_path':'/Applications/Google Chrome Canary/Contents/MacOS/Google Chrome Canary'}
B=Browser('chrome',**executable_path)
顺便说一句,Splinter对phantomjs有效
executable_path = {'executable_path':'/Applications/phantomjs/bin/phantomjs'}
B=Browser('phantomjs',**executable_path )
错误消息是
WebDriverException:消息:“Google Chrome Canary”可执行文件需要位于路径中。请看
这是路径,正如os.os.environ['path']
/Users/jonschull-MBPR/miniconda2/bin:/Applications/Google Chrome Canary/Contents/MacOS/Google Chrome Canary:/Users/jonschull-MBPR/miniconda2/bin:/Users/jonschull-MBPR/anaconda/bin:/Users/jonschull-MBPR/Downloads/google-cloud-sdk/bin:/opt/local/bin:/opt/local/sbin:/Users/jonschull-MBPR/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/chromedrive:/opt/X11/bin:/usr/local/mongodb/bin
顺便说一句,我试着避开“Google\Chrome\Canary”好吧,根据你只需要升级到splinter 0.7.6+。好吧,根据你只需要升级到splinter 0.7.6+。欢迎使用Stack Overflow,请添加你的解决方案作为答案,而不是编辑你的帖子。欢迎使用Stack Overflow,请将您的解决方案添加为答案,而不是编辑您的帖子。