Selenium click on specific button. Best way to click it

Viewed 46

I'm trying to click on a redirect button on a website to skip an ad, so I don't have to watch them. I'm using Chrome and I can't seem to get the XPath to work. Xpath: /html/body/lv-root/div[1]/mat-sidenav-container/mat-sidenav-content/div[2]/lv-redirect/div[1]/div[1]/div/div[1]/lv-redirect-first-page/lv-countdown-block/div/mat-card[2]/div[2]/div/div[3]/div/div/lv-button/a/span/text()

driver = uc.Chrome(options=options, use_subprocess=True)
driver.get(random.choice(URLS))

WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH, "/html/body/lv-root/div[1]/mat-sidenav-container/mat-sidenav-content/div[2]/lv-redirect/div[1]/div[1]/div/div[1]/lv-redirect-first-page/lv-countdown-block/div/mat-card[2]/div[2]/div/div[3]/div/div/lv-button/a/span/text()"))).click()

sleep(5.0)
pyautogui.click(x=650, y=1000)

I was using the module pyautogui on everything before but it is a hassle, so switching to this.

Any help would be appreciated :D

Note: I just started programming seriously (for me,) last month. So please don't come with the "Learn2Code" stuff without hinting me on what to do. We all started a place and would all want some help a couple of times (:

0 Answers
Related