0

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)

1
  • HTML "<div class="export-section width-custom"><ul class="export-subheader"> <li class="">Completed</li>" Commented Jun 14, 2020 at 9:09

2 Answers 2

1

The Element you will try to click isn't a link. 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()
Sign up to request clarification or add additional context in comments.

Comments

0

Use xpath:

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();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.