I
I
Igor2021-09-05 12:28:19
Python
Igor, 2021-09-05 12:28:19

Selenium throws errors - what's the problem?

Hello!
Started to deal with Selenium. Entered:

import time
from selenium import webdriver

driver = webdriver.Chrome(r'C:\Users\Igor\Bin\chromedriver.exe')
# driver = webdriver.Firefox(r'C:\Users\Igor\Bin\geckodriver.exe')
driver.maximize_window()
driver.get('http://www.google.com/')
time.sleep(15)
driver.quit()


Chrome gives the following errors:
Traceback (most recent call last):
  File "C:/Users/Igor/PycharmProjects/parser_01/parser_02.py", line 4, in <module>
    driver = webdriver.Chrome(r'C:\Users\Igor\Bin\chromedriver.exe')
  File "C:\Users\Igor\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "C:\Users\Igor\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\Igor\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\Igor\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Igor\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist


In Firefox, these are:
Traceback (most recent call last):
  File "C:/Users/Igor/PycharmProjects/parser_01/parser_02.py", line 5, in <module>
    driver = webdriver.Firefox(r'C:\Users\Igor\Bin\geckodriver.exe')
  File "C:\Users\Igor\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 151, in __init__
    firefox_profile = FirefoxProfile(firefox_profile)
  File "C:\Users\Igor\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 80, in __init__
    ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))
  File "C:\Users\Igor\AppData\Local\Programs\Python\Python37\lib\shutil.py", line 318, in copytree
    names = os.listdir(src)
NotADirectoryError: [WinError 267] Неверно задано имя папки: 'C:\\Users\\Igor\\Bin\\geckodriver.exe'


The path is in PATH. What does he lack?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2021-09-05
@EgorKus

Understood. In Chrome, I have 2 user profiles.
When loading, apparently, the program, apparently, does not know under which profile to enter and because of this it does not start. Deleted the 2nd profile in Chrome - it worked.
I haven't tested it in Firefox yet, but it's not critical for me right now.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question