from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.get("https://www.amazon.in/SAMSUNG-Galaxy-S23-Mint-Storage/dp/B0CJXPYJC3/")
try:
price = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.CLASS_NAME, "a-price-whole"))
)
print(price.text)
finally:
driver.quit()
I believe it couldve been because the browser was closing before selenium could extract the data, but i tried to add a delay and it still didnt work.
New contributor
DotBox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.