Wait until page loads before click() using Selenium Webdriver

0 votes
driver.find_element_by_id("ch4_loginGuestBtn").click()

This command intermittently fails with:

"Element is not clickable"

I'm guessing I need to do something like the following.

    guestlogin_button = wait.until(EC.visibility_of_element_located((By.id, ".ch4_loginGuestBtn")))

    actions = ActionChains(driver)

    actions.move_to_element(guestlogin_button).click().perform()

This is, however, failing with:

AttributeError: type object 'By' has no attribute 'id'

What am I doing wrong, how do I fix the wait.until line?

Aug 8, 2018 in Selenium by Martin
• 4,320 points
1,628 views

1 answer to this question.

0 votes

Change the following

guestlogin_button = wait.until(EC.visibility_of_element_located((By.id, ".ch4_loginGuestBtn")))

to

guestlogin_button = wait.until(EC.visibility_of_element_located((By.ID, ".ch4_loginGuestBtn")))

answered Aug 8, 2018 by Samarpit
• 5,870 points

Related Questions In Selenium

+1 vote
3 answers

Need to wait until page is completely loaded - Selenium WebDriver

You can try something like -  new WebDriverWait(firefoxDriver, ...READ MORE

answered Dec 20, 2019 in Selenium by Robin
11,486 views
0 votes
1 answer

30 min Wait on a page and then perform any Operation using Selenium Webdriver

Implicit wait tells webdriver to poll the ...READ MORE

answered Apr 19, 2018 in Selenium by Shubham
• 13,380 points
300 views
0 votes
1 answer

Double click a record in a grid using Selenium webdriver

Try Actions class to perform this Actions action ...READ MORE

answered Mar 29, 2018 in Selenium by Damon Salvatore
• 5,540 points
1,644 views
0 votes
1 answer

How to scroll the Page up or down in Selenium WebDriver? (using java)

Its pretty simple. Check out the below ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,510 points
11,034 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,510 points
2,227 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,870 points
1,840 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,870 points
1,829 views
0 votes
2 answers

Click Allow on Show Notifications popup using Selenium Webdriver

Try this: Robot robot = new Robot(); robot.delay(5000); robot.keyPress(KeyEvent.VK_TAB); robot.keyPress(KeyEvent.VK_ENTER); hope this ...READ MORE

answered Feb 29 in Selenium by anuj
10,511 views
0 votes
2 answers

How to set Page Load Timeout using C# using Selenium WebDriver

driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(15); READ MORE

answered Apr 16, 2019 in Selenium by Tim Muir
2,854 views