1
鉻我有以下代碼測試使用硒和Python
import time
from selenium import webdriver
import selenium.webdriver.chrome.service as service
chromedriver_path = "/Users/stephen/Downloads/chromedriver2_mac32_0.8/chromedriver"
chromium_path = "/Users/stephen/Downloads/chrome-mac/Chromium.app/Contents/MacOs/Chromium"
service = service.Service(chromedriver_path)
service.start()
capabilities = {'chrome.binary': chromium_path}
driver = webdriver.Remote(
service.service_url,
desired_capabilities=capabilities)
driver.get('http://www.google.com/xhtml');
time.sleep(5) # Let the user actually see something!
driver.quit()
不幸的是,當我運行上面的Python腳本,硒很客氣地完全忽略了,我想用Chromium
的事實,而是使用我的默認Google Chrome
。清楚的是,它確實是腳本指定的內容,它只是使用Chrome而不是Chromium。
顯然,我做錯了什麼。我將我的嘗試建立在以下幾頁之外。
https://code.google.com/p/chromedriver/wiki/GettingStarted
什麼我需要做的,用硒(在Python)的鉻網絡瀏覽器?