Untitled
unknown
plain_text
2 years ago
1.4 kB
1
Indexable
Never
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver import ActionChains from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.options import Options import time, os import funkcje chrome_options = Options() options = webdriver.ChromeOptions() driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options) #Chrome Options (Extra Things For The Driver To Do On Start) #Start With Window Maximized (Simple Detection Avoidance) options.add_argument("start-maximized") #Start With No Useless Popups (Simple Detection Avoidance) options.add_argument("disable-infobars") driver.get("https://www.techwithtim.net") search = driver.find_element_by_name("s") search.send_keys("test") time.sleep(3) search.send_keys(Keys.RETURN) try: main = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.ID, "main")) ) articles = main.find_elements_by_tag_name("article") for article in articles: header = article.find_element_by_class_name("entry-summary") print(header.text) finally: driver.quit()