Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in DevOps and Agile by (19.7k points)

Trying to learn how to use selenium, I managed to overcome first error which involved chrome driver not being in the pathname but it has thrown up another error.

from selenium import webdriver

    from selenium.webdriver.common.keys import Keys

    driver = webdriver.Chrome('/Users/bhamra/Scratch/Titanic/chromedriver')

    driver.get("http://www.bbc.com")

The error: Traceback (most recent call last):

File "<ipython-input-1-84256e62b8db>", line 5, in <module>

    driver = webdriver.Chrome('/Users/bhamra/Scratch/Titanic/chromedriver')

  File "/Users/bhamra/anaconda/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__

    self.service.start()

  File "/Users/bhamra/anaconda/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 64, in start

    stdout=self.log_file, stderr=self.log_file)

  File "/Users/bhamra/anaconda/lib/python3.5/subprocess.py", line 950, in __init__

    restore_signals, start_new_session)

  File "/Users/bhamra/anaconda/lib/python3.5/subprocess.py", line 1544, in _execute_child

    raise child_exception_type(errno_num, err_msg)

OSError: [Errno 8] Exec format error

I thought of applying a solution which involves installing Chrome Drivers via Home Brew but that option is not available to me.

Any ideas?

1 Answer

0 votes
by (62.9k points)

This error says about the format of chromedriver binary. It might be because of the mismatch of the format of the platform and chromedriver. For example, windows require chromedriver.exe while there are different formats for Linux and Mac.

If you don't want to install through the package manager, just download chromedriver from https://sites.google.com/a/chromium.org/chromedriver/downloads

Note: Choose file as per your Operating System

Then place it anywhere on our system and pass that path as an argument. You can also set webdriver.chrome.driver environment variable if you don't want to pass the location every time.

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s automation testing certification!

Browse Categories

...