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,220 points
422 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,130 points

Related Questions In Selenium

0 votes
2 answers
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,290 points
121 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,510 points
992 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,090 points
7,223 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,090 points
592 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
901 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
580 views
0 votes
1 answer

Click Allow on Show Notifications popup using Selenium Webdriver

Create a instance of ChromeOptions class ChromeOptions options ...READ MORE

answered Jun 20, 2018 in Selenium by Samarpit
• 5,130 points
5,622 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 in Selenium by Tim Muir
1,564 views