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,330 points
2,428 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,890 points

Related Questions In Selenium

+1 vote
4 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
24,612 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,450 points
545 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,550 points
2,206 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,510 points
3,474 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

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

answered Aug 31 in Selenium by Sri
• 2,970 points
4,487 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,890 points
2,567 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 2 in Selenium by Sri
• 2,970 points
2,803 views
0 votes
3 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
15,032 views
0 votes
3 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
4,313 views