使用pip安裝Selenium。可執行文件需要在PATH中 - 在Android上的GNURoot上運行Selenium
嘗試下面的代碼運行:
import selenium
from selenium import webdriver
\#driver = webdriver.Chrome()
driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver')
time.sleep(5)
driver.quit()
我能得到什麼:
蟒蛇5formscrape-selenium.py
回溯(最近通話最後一個):
文件「5formscrape-selenium.py」,第5行,驅動程序= webdriver.Chrome(executable_path ='/ usr/bin/chromedrive R')
文件 「/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py」, 線62,在初始化 self.service.start( )
文件 「/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py」, 線81,在開始os.path.basename(self.path) , self.start_error_message) selenium.common.exceptions.WebDriverException:消息:'chromedriver' 可執行文件需要位於PATH中。請參閱 https://sites.google.com/a/chromium.org/chromedriver/home
$PATH
包含/usr/bin/chromedriver
chromedriver文件是/usr/bin
與特權
sudo chmod a*x chromedriver
那麼我在這裏失蹤?
搜索
chromedriver
已經嘗試過,顯示了同樣的錯誤。 – JackS在你的腳本中添加這個並告訴我輸出'import os;進口系統;導入子進程;打印(sys.path中); print(os.getenv('PYTHONPATH')),print(subprocess.check_output([「which」,「chromedriver」]));「 –
['/ sdcard/3python2','/usr/lib/python2.7' ,'/usr/lib/python2.7/plat-arm-linux-gnueabihf','/usr/lib/python2.7/lib-tk','/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload','/usr/local/lib/python2.7/dist-packages','/usr/lib/python2.7/dist-packages','/ usr /lib/pymodules/python2.7' ] 無 在/ usr/bin中/ chromedriver – JackS