Python Forum
TypeError: to_capabilities() missing 1 required positional argument: 'self'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: to_capabilities() missing 1 required positional argument: 'self'
#1
Wall
Error =
Error:
Traceback (most recent call last): File "main.py", line 19, in <module> driver = webdriver.Chrome(CHROMEDRIVER, options=Options) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 64, in __init__ desired_capabilities = options.to_capabilities() TypeError: to_capabilities() missing 1 required positional argument: 'self'
Code =
import requests
from time import sleep
from selenium import webdriver  # accessing Chrome
from selenium.webdriver.chrome.options import Options


# Startup the Webdriver FireFox or Chrome
CHROMEDRIVER = "C:\ChromeDriver\chromedriver.exe"# (executable_path='C:\ChromeDriver\chromedriver.exe') 

URL = "https://www.amazon.com/Samsung-Business-3440x1440-Ultrawide-LC34H890WGNXGO/dp/B08623SZH9"
title_id = "productTitle"
price_id = "priceblock_ourprice"
image_url_id = "landingImage"


options = Options()
options.add_argument("--headless")

driver = webdriver.Chrome(CHROMEDRIVER, options=Options)

driver.get(URL)

# To get the prodcut title text
product_title = driver.find_element_by_id(title_id).text
product_price = driver.find_element_by_id(price_id).text
product_image_url = driver.find_element_by_id(image_url_id).get_attribute('src')

print(product_title)
print(product_price)
print(product_image_url)
buran write Dec-02-2020, 07:56 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply
#2
line#19 should be
driver = webdriver.Chrome(CHROMEDRIVER, options=options)
OceansBlue likes this post
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Thumbs Up 
Much Appreciated!

(Dec-02-2020, 07:57 AM)buran Wrote: line#19 should be
driver = webdriver.Chrome(CHROMEDRIVER, options=options)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Django views : positional argument ghoul 0 1,448 Nov-15-2021, 06:02 PM
Last Post: ghoul
  TypeError: missing 1 required positional argument (word counter Django app) Drone4four 2 14,612 Jul-11-2019, 09:34 PM
Last Post: Drone4four
  TypeError("index() missing 1 required positional argument: 'pymydb'" nikos 2 4,261 Mar-03-2019, 09:21 PM
Last Post: micseydel
  TypeError: get_names() takes 0 positional arguments but 1 was given Truman 2 10,205 Aug-15-2018, 10:32 PM
Last Post: Truman
  TypeError: Method takes takes exactly 1 argument but 2 given pras120687 1 9,122 Dec-15-2016, 07:10 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020