あなたのシステムにはFirefoxが見つかりませんでした
といってますが、Firefox実行できますか?
下のプログラムをUBUNTUでしたらエラー
python
1def driver(t): 2 import time 3 from selenium import webdriver 4 from selenium.webdriver.common.by import By 5 from selenium.webdriver.support.ui import WebDriverWait 6 from selenium.webdriver.support import expected_conditions as EC 7 from selenium.common.exceptions import TimeoutException 8 from selenium.webdriver.common.desired_capabilities import DesiredCapabilities 9 from selenium.webdriver.firefox.options import Options 10 from selenium.webdriver.firefox.firefox_binary import FirefoxBinary 11 binary = FirefoxBinary("/mnt/c/Users/a.tanaka/AppData/Local/packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/usr/bin/firefox") 12 cap = DesiredCapabilities().FIREFOX 13 cap["marionette"] =True 14 cap['binary'] = '/usr/bin/firefox' 15 path="C:/Users/s.tanaka/AppData/Local/Packages/ CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/usr/local/bin/geckodriver" 16 retry=3 17 for i in range(retry): 18 try: 19 options = Options() 20 options.headless = True 21 print("first")(options=options,executable_path=path,capabilities=cap) 22 browser=webdriver.Firefox(executable_path=path,firefox_binary=binary) 23 print("second") 24 except Exception as e: 25 print(e) 26 time.sleep(i*5) 27 try: 28 browser.get(t) 29 except: 30 return None 31 print(browser.page_source) 32 browser.quit() 33 34 35 36 driver("https://tmg0525.hatenadiary.jp/entry/2017/08/18/234048") 37 38 39firefoxは 起動可能 40ls -l /usr/bin/firefoxの結果 41drwxr-xr-x 1 tyui45 tyui45 512 Apr 28 06:35 firefox 42権限付与できた(?) 43 44状況 45first 46error
あなたの回答
tips
プレビュー