2

I am trying to code basic python-Google Chrome interactions with webdriver but I constantly get the same error while trying to launch a link on my browser.

Here is my code:

from selenium import webdriver import os class Instagrambot: def __init__(self, username, password): self.username = username self.password = password self.driver = webdriver.Chrome('./chromedriver.exe') if __name__ == '__main__': ig_bot = Instagrambot('temp_username', 'temp_password') 

I have the chromedriver in the current directory, and I am using the correct version of the chromedriver (79.0.3945.36) for my browser (Chrome 79.0.3945.88) . The full error I am getting is:

Traceback (most recent call last): File "c:/Users/Arthur/Documents/instabot/bot.py", line 16, in <module> ig_bot = Instagrambot('temp_username', 'temp_password') File "c:/Users/Arthur/Documents/instabot/bot.py", line 12, in __init__ self.driver = webdriver.Chrome('./chromedriver.exe') File "C:\Users\Arthur\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__desired_capabilities=desired_capabilities) File "C:\Users\Arthur\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__self.start_session(capabilities, browser_profile) File "C:\Users\Arthur\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "C:\Users\Arthur\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\Arthur\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.WebDriverException: Message: unknown error: Failed to create a Chrome process. 

I have already tried:

Writing the full executable path towards chromedriver.exe (same folder of bot.py)

Overriding the Chrome binary location as suggested in this answer: https://stackoverflow.com/a/53078276/11206079

If anyone can help me or give any insight about how to fix it I would be really glad!

1

1 Answer 1

2

This error message...

selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process. 

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.

I don't see any such issue in your code block. However, a bit more details about your Test Environment with respect to version of the binaries and user type you are using would have helped us to debug the issue in a better way. However most possibly you are executing your test as an administrator


Thumb rule

A common cause for Chrome to crash during startup is running Chrome as root user (administrator) on Linux. While it is possible to work around this issue by passing --no-sandbox flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Chrome as a regular user instead.


Additional considerations

Ensure that:

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.