Wait for an element to be accessible using Selenium WebDriver

0 votes

I am automating a web application. I found that some commands bring up dialog boxes that have controls that are visible, but not accessible.

How to wait for the element to be actually accessible, and not just visible?

Below is the code that I tried, but it is not working out for me:

    try:
        print "wait for the element"
        element = WebDriverWait(driver, 10).until(lambda driver : driver.find_element_by_id("Btn_1"))
        print "not found!"
    finally: print 'yoo'

May 18, 2018 in Selenium by Meci Matt
• 9,460 points
1,762 views

1 answer to this question.

0 votes

You can try out the below code:

    print time.time()
    try:
        print "wait for the element"
        def find(driver):
            web = driver.find_element_by_id("Btn_1")
            if (web.get_attribute("disabled")=='true'):
                return False
            return web
        element = WebDriverWait(driver, 10).until(find)
        print "not found!"
    finally: print 'yoo'
    print "ok"
    print time.time()

answered May 18, 2018 by Atul
• 10,240 points

Related Questions In Selenium

0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

How to apply wait for new window using Selenium WebDriver?

As sometimes during web automation, when you ...READ MORE

answered Jul 10, 2019 in Selenium by Vaishali Walia
9,157 views
0 votes
1 answer

Locating an element by value using css selector using Selenium WebDriver

Below code will help By.cssSelector("td[class='someclass'][value=' ...READ MORE

answered Apr 9, 2018 in Selenium by coldcode
• 2,090 points
2,101 views
0 votes
1 answer

Using gettext() method for the specific element using Selenium WebDriver

Mistake is that u r printing the ...READ MORE

answered Apr 10, 2018 in Selenium by Vardy
• 2,360 points
28,717 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,673 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,142 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,874 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP