โดย rangsan » 07/05/2018 6:49 pm
ขั้นตอนการติดตั้งผ่าน Terminal
ภาพประกอบ
- install_selenium.png (9.36 KiB) Viewed 1017 times
ผลลัพธ์การรันโค้ด
- output_install_selenium.png (48.89 KiB) Viewed 1017 times
เมื่อทำการรันโค้ดบน Pycharm
โค้ด: เลือกทั้งหมด
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('https://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 หรือเปล่าครับ
ขั้นตอนการติดตั้งผ่าน Terminal
[code]sudo pip install selenium[/code]
ภาพประกอบ
[attachment=2]install_selenium.png[/attachment]
ผลลัพธ์การรันโค้ด
[attachment=1]output_install_selenium.png[/attachment]
เมื่อทำการรันโค้ดบน Pycharm
[code]from selenium import webdriver
browser = webdriver.Firefox()
browser.get('https://www.mindphp.com')
[/code]
ผลัพธ์ Error
[code]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.[/code]ง
ภาพประกอบ
[attachment=0]Error_code.png[/attachment]
เหมือนโปรแกรมต้องการไฟล์ geckodriver หรือเปล่าครับ