Ошибка при использовании модуля селена python. Попытка нажать кнопку на сайте DocDroid. https://www.docdroid.net/ - PullRequest
0 голосов
/ 02 мая 2020
#Function to click a button on DocDroid website

def sendpdf():
    import selenium
    driver=webdriver.Chrome()
    driver.get('https://www.docdroid.net/')
    upload_box=driver.find_element_by_id('select')
    upload_box.click()

sendpdf()

если я добавляю 'from selenium import webdriver', я получаю следующую ошибку:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/User/Desktop/Computer Projects/Virus/pdfsend.py", line 11, in <module>
    sendpdf()
  File "C:/Users/User/Desktop/Computer Projects/Virus/pdfsend.py", line 6, in sendpdf
    driver=webdriver.Chrome()
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

>>> 

По какой-то причине я получаю следующую ошибку:

NameError: name 'webdriver' is not defined

packages \ selenium \ webdriver \ chrome \ webdriver.py ", строка 73, в файле init self.service.start ()" C: \ Users \ Пользователь \ AppData \ Local \ Programs \ Python \ Python38 \ lib \ site-packages \ selenium \ webdriver \ common \ service.py ", строка 81, в начале вызывает WebDriverException (selenium.common.exceptions.WebDriverException: Сообщение: исполняемый файл chromedriver должен находиться в переменной PATH. См. https://sites.google.com/a/chromium.org/chromedriver/home

1 Ответ

0 голосов
/ 02 мая 2020

Вам необходимо добавить chromedriver в вашу системную PATH, вы можете скачать его с здесь

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...