From 53e3bf6b7f9fbe159c280ac4b521bc1d35f699dc Mon Sep 17 00:00:00 2001 From: Muhammad Ibrahim Date: Thu, 28 Nov 2024 21:38:25 +0530 Subject: [PATCH] Added a bit more price displayer code --- Visual Studio Code Projects/Day-48/main.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Visual Studio Code Projects/Day-48/main.py b/Visual Studio Code Projects/Day-48/main.py index 3ccae0f..b385bb1 100644 --- a/Visual Studio Code Projects/Day-48/main.py +++ b/Visual Studio Code Projects/Day-48/main.py @@ -1,2 +1,16 @@ from selenium import webdriver -driver = webdriver.Chrome() \ No newline at end of file +from selenium.webdriver.common.by import By + +# Keep Google Chrome open after program finishes +chrome_options = webdriver.ChromeOptions() +chrome_options.add_experimental_option("detach", True) + +driver = webdriver.Chrome(options=chrome_options) +driver.get("Your Product link here") + +price_dollar = driver.find_element(By.CLASS_NAME, value="your price dollar or rupee class value") +price_cents = driver.find_element(By.CLASS_NAME, value="your price cents or paise class value") + +print(f"The price of your product is {price_dollar.text}.{price_cents.text}") + +driver.quit() \ No newline at end of file