The first time I work with Selenium. Trying to execute the following code:

from selenium import webdriver ChromeAdr = r'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' browser = webdriver.Chrome(ChromeAdr) browser.get('http://vk.com') 

Chrome opens successfully, but the get method is not executed; instead, an error occurs:

 Traceback (most recent call last): File "D:/Users/    /PycharmProjects/BurgerScam/BurgeHuyrger.py", line 5, in <module> browser = webdriver.Chrome(ChromeAdr) File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__ self.service.start() File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start self.assert_process_still_running() File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 99, in assert_process_still_running % (self.path, return_code) selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\Application\chrome.exe unexpectedly exited. Status code was: 0 

And I do not understand what to do with it. I also tried to use Chrome instead of Firefox, but alas, with no result, because in Firefox I get an error

Failed to load your Firefox profile.

  • You do not need chrome to run and chromedriver.exe - John Doe
  • one
    And the user is preferably not in Cyrillic. - Nakilon

1 answer 1

Because you use the usual browser exe, it will not work. For testing, you need to download a special driver, in your case - chromeDriver .

then point the way to it -

 driver = webdriver.Chrome('/путь/до/драйвера') 

And do not forget to close the chrome after performing all the necessary actions.

 driver.close() driver.quit() 

otherwise, the cache will not be deleted and the temp folder very quickly eats up all the memory.