Splnter selenium无头与铬金丝雀(蟒蛇)

时间:2017-08-05 19:07:16

标签: 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()  
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'可执行文件需要在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

顺便说一下,我试图逃避" Google \ Chrome \ Canary"

1 个答案:

答案 0 :(得分:0)

好吧,根据issue in splinter's git你只需要升级到分裂0.7.6 +。