【发布时间】:2021-03-30 00:04:03
【问题描述】:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import random
# linha 69 , linha 1 , liniha 18, linha 3,linha 77
class programBot:
def __init__(self, username, password):
self.username = username
self.password = password
self.driver = webdriver.Firefox(executable_path="geckodriver")
def login(self):
driver = self.driver
driver.get("https://www.google.com")
testebot = InstagramBot('random','random')
time.sleep(3)
Estoutentando executar um programa no python porém semper aparece essa mensagem de erro, isso no linux mint 20.1 , eu não sei ao certo como resolver, alguém da um help ?
Traceback (most recent call last):
File "/home/mylogin/.local/lib/python3.8/site-
packages/selenium/webdriver/common/service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'
During handling of the above exception, another exception occurred
Traceback (most recent call last):
File "bot.py", line 17, in <module>
cassiobot = TESTEBot('random','random')
File "bot.py", line 11, in __init__
self.driver = webdriver.Firefox(executable_path="geckodriver")
File "/home/meulogn/.local/lib/python3.8/site-
packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/home/ti-pampulhavalley/.local/lib/python3.8/site-
packages/selenium/webdriver/common/service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to
be in PATH.
【问题讨论】:
-
英文请...
-
我投票结束这个问题,因为它不是英文的
-
堆栈溢出是English-only site!请参阅 Stack Overflow 的其他非英文版本的 the list。特别是Stack Overflow em Português
-
但我的问题是在 pt stackoverflow 中提出的!我正在使用英语和葡萄牙语这两个站点,但是该帐户是一个。当我用葡萄牙语提问时,你有时也会出现..所以请放轻松!无需投票即可结束问题!
标签: python linux selenium selenium-webdriver webdriver