2017-08-05 2 views
1

Ich kann einen kopflosen Browser mit Selen und Chrome Canary fahren. Aber ich kann es nicht mit Splinter arbeiten.Splnter selen kopflos mit Chrome Canary (Python)

Vielen Dank im Voraus.

Hier ist was funktioniert.

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) 

Hier ist, was nicht funktioniert:

from splinter import Browser 
executable_path = {'executable_path':'/Applications/Google Chrome Canary/Contents/MacOS/Google Chrome Canary'} 
B=Browser('chrome',**executable_path) 

Übrigens Splinter DOES Arbeit mit PhantomJS

executable_path = {'executable_path':'/Applications/phantomjs/bin/phantomjs'} 
B=Browser('phantomjs',**executable_path) 

Die Fehlermeldung ist

WebDriverException: Nachricht: ‚Google Chrome Canary 'muss ausführbar sein PFAD. Bitte sehen https://sites.google.com/a/chromium.org/chromedriver/home

hier der Weg ist, wahrgenommen als von 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 

Und übrigens habe ich versucht, "Google \ Chrome \ Canary"

+0

Willkommen bei Stack Overflow, bitte fügen Sie Ihre Lösung als Antwort, anstatt Ihren Beitrag zu bearbeiten. –

Antwort

Verwandte Themen