Correct syntax for By.PARTIAL_TEXT_LINK in Selenium Python

83 Views Asked by At

How to click using By.Partial_Text_Link in a proper way?

There is probably a syntax error, but pycharm doesn't give me a solution.

The searched element is not found, the program stops. The faulty code looks like this:

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.PARTIAL_LINK_TEXT, value="LogSyS"))).click()

How does the syntax have to look like?

This code iswebdriverwa working, but i need WebDriverWait function:

driver.find_element(By.PARTIAL_LINK_TEXT, value= "LogSys").click()
1

There are 1 best solutions below

0
On

Had there been a syntax error you would have faced a TypeError which seems isn't the case in hand.

To click using By.PARTIAL_LINK_TEXT you can use the following optimized syntax:

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.PARTIAL_LINK_TEXT, "LogSyS"))).click()

If the desired element is still not located/found and raises a TimeoutException you may have a to relook at the locator strategy