From 71cce6b3d2413ae66d18e6112c45303927e07542 Mon Sep 17 00:00:00 2001 From: Muhammad Ibrahim Date: Fri, 29 Nov 2024 20:48:28 +0530 Subject: [PATCH] Added a list of events of Python.org --- Visual Studio Code Projects/Day-48/main.py | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Visual Studio Code Projects/Day-48/main.py b/Visual Studio Code Projects/Day-48/main.py index b385bb1..a39203d 100644 --- a/Visual Studio Code Projects/Day-48/main.py +++ b/Visual Studio Code Projects/Day-48/main.py @@ -3,14 +3,32 @@ 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) +chrome_options.add_experimental_option("detach", False) 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") +driver.get("https://www.python.org/") -print(f"The price of your product is {price_dollar.text}.{price_cents.text}") +search_bar = driver.find_element(By.NAME, value="q") + +button = driver.find_element(By.ID, value="submit") + +documentation_link = driver.find_element(By.CSS_SELECTOR, value=".documentation-widget a") + +# bug_link = driver.find_element(By.XPATH, value='//*[@id="site-map]/div[2]/div/ul/li[3]/a') + +tier_1 = driver.find_elements(By.CLASS_NAME, value="tier-1") + +event_times = driver.find_elements(By.CSS_SELECTOR, value=".event-widget time") +event_names = driver.find_elements(By.CSS_SELECTOR, value=".event-widget li a") +events = {} + +for n in range(len(event_times)): + events[n] = { + "time": event_times[n].text, + "name": event_names[n].text, +} + +print(events) driver.quit() \ No newline at end of file