Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

  The code is failing after the first line. I have reinstalled Google Chrome, reinstalled the webdriver, and selenium, however I can't seem to resolve the issue. 

I am trying to use selenium and python using chromedriver, but I can't seem to get past a string of errors. I've troubleshooted using just about everything. Any help would be greatly appreciated!

from selenium import webdriver

os.environ[""] = chromedriver

# browser = webdriver.Chrome(chromedriver)

# browser.get("")

# title = browser.title

# print(title)

Here is the Code I have tried. I've also tried this...

from selenium import webdriver

# browser = webdriver.Chrome()

# browser.get("")

# title = browser.title

# print(title)

I expect it to launch a webpage, however, I just get a string of errors.

Traceback (most recent call last):

  File "/Users/trapbookpro/Downloads/PythonLoginScripts/", line 1, in <module>

    from selenium import webdriver

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/", line 18, in <module>

    from .firefox.webdriver import WebDriver as Firefox  # noqa

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/firefox/", line 29, in <module>

    from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/", line 21, in <module>

    import copy

  File "/Users/trapbookpro/Downloads/PythonLoginScripts/", line 10, in <module>


1 Answer

0 votes
by (62.9k points)

You just need to add driver path like:

driver_path = r'your driver path'

browser = webdriver.Chrome(executable_path=driver_path)

and get titles like :

from selenium import webdriver driver_path = r'your path' browser = webdriver.Chrome(executable_path=driver_path) browser.get("") title = browser.title print(title)

Output :

NYU Login

Browse Categories