โค้ด: เลือกทั้งหมด
sudo pip install selenium
ภาพประกอบ
ผลลัพธ์การรันโค้ด
เมื่อทำการรันโค้ดบน Pycharm
โค้ด: เลือกทั้งหมด
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://www.mindphp.com')
ผลัพธ์ Error
โค้ด: เลือกทั้งหมด
Traceback (most recent call last):
File "/home/com003/PycharmProjects/m058/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver': 'geckodriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/com003/PycharmProjects/m058/test.py", line 3, in <module>
browser = webdriver.Firefox()
File "/home/com003/PycharmProjects/m058/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
self.service.start()
File "/home/com003/PycharmProjects/m058/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
ภาพประกอบ
เหมือนโปรแกรมต้องการไฟล์ geckodriver หรือเปล่าครับ