Splnter selenium与Chrome加那利无头(Python)
问题描述:
我可以驱动一个无头浏览器使用硒和铬金丝雀。 但我无法使用分裂工作。Splnter selenium与Chrome加那利无头(Python)
在此先感谢。
这是有用的。
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)
顺便分裂不工作与phantomjs
executable_path = {'executable_path':'/Applications/phantomjs/bin/phantomjs'}
B=Browser('phantomjs',**executable_path)
的错误消息是
WebDriverException:消息:“谷歌Chrome Canary的可执行文件需要处于PATH。请参阅https://sites.google.com/a/chromium.org/chromedriver/home
这里的路径,通过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
感知并顺便说一下,我试图逃离 “谷歌\镀铬\金丝雀”
欢迎使用Stack Overflow,请将您的解决方案作为答案添加,而不是编辑您的帖子。 –