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,400 points
68 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,200 points

Related Questions In Selenium

0 votes
1 answer
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='u ...READ MORE

answered Apr 9, 2018 in Selenium by coldcode
• 1,980 points
58 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,280 points
2,515 views
0 votes
1 answer
0 votes
1 answer

Need to scroll down for locating an Element with Selenium

There are a couple of options for ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,590 points
43 views
0 votes
1 answer

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,030 points
71 views
0 votes
1 answer
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,130 points
442 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
55 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.