mixhostで契約しているサーバーにseleniumを通してgooglechromeを起動し色々実行したいと考えています。
下記ソースを実施するとエラーが発生します。
googlechrome自体がインストールされていないことが原因だと考えています。
sudo,yum,wgetなどのコマンドが使えない状態でインストールすることは可能でしょうか。
どうぞご教授よろしくお願い申し上げます。
ファイル名:headress-chrome.py
sh
1from selenium import webdriver 2from selenium.webdriver.chrome.options import Options 3import time 4 5options = Options() 6options.add_argument('--headless') 7driver = webdriver.Chrome('絶対パス/chromedriver',chrome_options=options) 8 9driver.get('https://www.google.co.jp/') 10 11time.sleep(5) 12 13driver.quit()
error
1Traceback (most recent call last): 2 File "headress-chrome.py", line 8, in <module> 3 driver = webdriver.Chrome('/home/ユーザー名/opt/chromedriver',chrome_options=options) 4 File "/home/ユーザー名/.local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__ 5 self.service.start() 6 File "/home/ユーザー名/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 98, in start 7 self.assert_process_still_running() 8 File "/home/ユーザー名/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running 9 % (self.path, return_code) 10selenium.common.exceptions.WebDriverException: Message: Service /home/ユーザー名/opt/chromedriver unexpectedly exited. Status code was: -11
あなたの回答
tips
プレビュー