我正在使用 python ana selenium 来自动化某些过程,但无法将 selenium 附加到我尝试使用的默认 chrome 配置文件中,
capability = webdriver.DesiredCapabilities.CHROME
self.driver = webdriver.Remote('http://127.0.0.1:9515/wd/hib',capability)
当然,我首先开始使用chromedriver,并且还尝试过,
import time
from selenium import webdriver
import selenium.webdriver.chrome.service as service
service = service.Service('./chromedriver')
service.start()
capabilities = {'chrome.binary': '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'}
driver = webdriver.Remote(service.service_url, capabilities)
driver.get('http://www.google.com/xhtml');
time.sleep(5) # Let the user actually see something!
driver.quit()
这会导致 selenium.common.exceptions.WebDriverException: Message: u'Could not find Chrome binary at:
并尝试过,
self.driver = webdriver.Chrome("./chromedriver")
这有效,但不是默认配置文件,并且还想知道如何用这个打开新窗口或新标签?
谢谢。