Here is the full code:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Edge(executable_path = r"C:\Users\H\Desktop\Automated_Tasks\msedgedriver.exe") # Modify the path here...
# Navigate to URL
driver.get("https://powerusers.microsoft.com/t5/notificationfeed/page")
#accept cookies
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div[2]/center/div[1]/div/div[2]/button[1]"))).click()
#click button
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[@class='lia-button lia-button-primary view-more-icon lia-link-ticket-post-action' and @id='viewMoreLink'][contains(@href, 'notificationList')]/span[text()='Show more']"))).click()
The following line:
button=WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "viewMoreLink"))).click()
gives an error:
File C:\Program Files\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py:249 in check_response
raise exception_class(message, screen, stacktrace)
ElementClickInterceptedException: element click intercepted: Element is not clickable at point (476, 1865)
(Session info: MicrosoftEdge=109.0.1518.61)
Here is the HTML for the button I'm trying to click.
<a onclick="return LITHIUM.EarlyEventCapture(this, 'click', true)" class="lia-button lia-button-primary view-more-icon lia-link-ticket-post-action" data-lia-action-token="gY01pJ4IhqNcqA8Ouq1d20HgZFI9CVTHrEYgxObqxWantjAxFsOxTacdu8LdHjd0" rel="nofollow" id="viewMoreLink" href="https://powerusers.microsoft.com/t5/notificationfeed/page.notificationlist.notificationlistitems.viewmorelink:viewmore/notificationfeed.lastLoadedTimestamp/1674422253100/notificationfeed.lastViewedTimestamp/1674505573710/container_element/notificationList"><span>Show more</span></a>
Here is a picture showing where the desired element is in: