Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

I will test a web-app. there is a button available in my table to select all entries. I've tried:

driver.wait.until(ExpectedCondition.element_to_be_clickable((By.XPATH, "myXpath"))).click()

Selenium clicks on the button, but nothing happens. (also with send_Keys(Keys.Return)) the application is developed with GXT, I think that there is much javascript behind the button. Is there is a possibility to wait until an event loader is ready? waiting before a click solves the problem, but not a solution for automated testing.

1 Answer

0 votes
by (62.9k points)

The explicit wait method in Python can correctly be written as:

 element = WebDriverWait(driver, 20).until(

 EC.presence_of_element_located((By.ID, "myElement")))

After performing the above syntax, you'd do: element.click();

In your case, the Java code should look like this:

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, "myXpath")))

element.click();

If you want to Learn What is Selenium visit this Selenium Tutorial by Intellipaat.

You can refer to our Python online course for more information.

Browse Categories

...