/usr/local/bin/chromedriver 目录是我 python3 目录
option = webdriver.ChromeOptions() option.add_argument('--start-maximized') # 最大化 option.add_argument('--headless') # 无界面
self.driver = webdriver.Chrome(chrome_options=option) self.phone_number = '15910846849' self.login_url = 'http://auth.qimingpian.com/finos.html' self.report_url='http://vip.qimingpian.com/#/finos/investment/ireport' self.cookies= os.getcwd() + "/" + "cookies"
报错如下: Traceback (most recent call last): File "qimingpian.py", line 119, in <module> qimingpian().get_content() File "qimingpian.py", line 13, in init self.driver = webdriver.Chrome(chrome_options=option) File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 75, in init desired_capabilities=desired_capabilities) File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in init self.start_session(capabilities, browser_profile) File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 245, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 314, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary (Driver info: chromedriver=2.39.562713 (dd642283e958a93ebf6891600db055f1f1b4f3b2),platform=Mac OS X 10.12.6 x86_64
1
brucedone 2018-07-18 15:48:21 +08:00
如果是 mac 呢,你可以考虑装个 docker,然后装 selenium 的 docker 镜像,好用的一 B,教程的话,看这里就可以了,http://brucedone.com/archives/1021
|
2
Phant0m 2018-07-18 17:04:01 +08:00
|