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.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
