Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Getting selenium.common.exceptions.TimeoutException: Message: while trying to click element via Link Text

Ask Question

I am trying to click an element By.Link test and getting the below error

raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message:

My Code:

wait=WebDriverWait(driver,30)
el=wait.until(EC.presence_of_element_located((By.LINK_TEXT, "Completed"))).click()

Element I am trying to Click (Completed)

HTML "<div class="export-section width-custom"><ul class="export-subheader"> <li class="">Completed</li>" – Piyush Jun 14, 2020 at 9:09 the following line need to be changed

el=wait.until(EC.presence_of_element_located((By.LINK_TEXT, "Completed"))).click()

try to locate it with another option like xpath: a complete liste can be found here Selenium-Webdriver

a possible solution could be:

el=wait.until(EC.presence_of_element_located((By.XPATH, //ul//li[text()='Completed']"))).click()
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
element = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((By.XPATH, "//ul//li[text()='Completed']")))
element.click();
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.