0

Following code is supposed to open Google chrome and Walmart page, but I came across the error below.

Code:

from selenium import webdriver 

driver = webdriver.Chrome

driver.get('https://www.walmart.com/')

Error:

Traceback (most recent call last):
  File "/Users/abdushukur/PycharmProjects/cloudacademy/automation.py", line 4, in <module>
    driver.get('https://www.walmart.com/')
TypeError: get() missing 1 required positional argument: 'url'
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Shakur T
  • 1
  • 1
  • 1
    I don't know Selenium, but by the look of it, I think you need to create an instance of a driver (with parentheses) `driver = webdriver.Chrome()` – FlorianGD Nov 19 '20 at 06:22

3 Answers3

0

The Selenium docs provides a small example on how to get started which shows that you need to create an instance of your driver (As FlorianGD mentioned in their comment) before you can get a URL from it. So your code would be -

from selenium import webdriver

driver = webdriver.Chrome()

driver.get("https://www.walmart.com/")

*This does assume that the chromedriver is in the same directory as the executed script. If it is not you need to specify the path to the chromedriver

Karan Shishoo
  • 2,402
  • 2
  • 17
  • 32
0

You should indicate the location of your chromedriver in

driver = webdriver.Chrome("your_chromedriver_path")
0

The constructor is driver = webdriver.Chrome(). So in your code block you need to replace the line driver = webdriver.Chrome with:

driver = webdriver.Chrome()

Additionally, you may need to pass the absolute path of the ChromeDriver binary as follows:

driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe')
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352