# -*- coding: utf-8 -*- from selenium import webdriver import sys from selenium.webdriver.common.keys import Keys browser = webdriver.Firefox() browser.get('https://vk.com') textarea = browser.find_element_by_css_selector('#index_email') textarea.send_keys('') textarea = browser.find_element_by_css_selector('#index_pass') textarea.send_keys('') submit = browser.find_element_by_css_selector('#index_login_button') submit.click() # DEBUG def log_uncaught_exceptions(ex_cls, ex, tb): text = '{}: {}:\n'.format(ex_cls.__name__, ex) import traceback text += ''.join(traceback.format_tb(tb)) print(text) sys.exit(1) sys.excepthook = log_uncaught_exceptions 

He writes such errors

 Traceback (most recent call last): File "C:/Users/Tom/Desktop/spammer/spammer.py", line 10, in <module> browser = webdriver.Firefox() File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ selenium\webdriver\firefox\webdriver.py", line 167, in __init__ keep_alive=True) File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ selenium\webdriver\remote\webdriver.py", line 156, in __init__ self.start_session(capabilities, browser_profile) File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\s elenium\webdriver\remote\webdriver.py", line 251, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ selenium\webdriver\remote\webdriver.py", line 320, in execute self.error_handler.check_response(response) File "C:\Users\Tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities 
  • Password changed, you can not try who saw XD - Maxim Khalin
  • Do you have a geckodriver installed? github.com/mozilla/geckodriver/releases - nick_gabpe pm
  • @nick_gabpe Yes, the driver put Geko in the folder with the launched file - Maxim Khalin
  • add just in case executable_path = '/ path / to / geckodriver', firefox_binary = '/ path / to / firefox / binary' - nick_gabpe
  • @nick_gabpe where to register? I apologize for the stupidity - Maxim Khalin

1 answer 1

Try to make sure 100% that this is not a geckodriver's fault:

 from selenium import webdriver from selenium.webdriver.firefox.firefox_profile import FirefoxProfile from selenium.webdriver.firefox.firefox_binary import FirefoxBinary binary = FirefoxBinary(path_to_ff_exe) profile = FirefoxProfile(path_to_ff_profile) # если запускаетесь с дефолтным, то можно пропустить browser = webdriver.Firefox(firefox_profile=profile, firefox_binary=binary, executable_path=path_to_geckodriver) 
  • Traceback (most recent call last): File "C:/Users/Tom/Desktop/spammer/spammer.py", line 10, in <module> binary = FirefoxBinary(path_to_ff_exe) NameError: name 'FirefoxBinary' is not defined - Maxim Khalin
  • @MaksimKhalin updated the answer - nick_gabpe
  • Traceback (most recent call last): File "C:/Users/Tom/Desktop/spammer/spammer.py", line 11, in <module> binary = FirefoxBinary(path_to_ff_exe) NameError: name 'path_to_ff_exe' is not defined - Maxim Khalin
  • path_to_ff_exe needs to be replaced with the path to the Firefox executable, and path_to_geckodriver to the path to geckodrivera - nick_gabpe
  • pycharm emphasizes \ Users to me - Maxim Khalin