Python Forum

Full Version: WebDriverWait
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want my script repeatedly to check for the existence of some element on a fully loaded page and
return only when that element exists.
from selenium import webdriver
from import By
from import WebDriverWait
from import expected_conditions as EC  
import time
options = Options()
caps = webdriver.DesiredCapabilities().FIREFOX
caps["marionette"] = True
browser = webdriver.Firefox(firefox_options=options, capabilities=caps, executable_path=r"geckodriver.exe")
	element = WebDriverWait(browser, 10).until(EC.presence_of_element_located(By.ID, "loadedButton"))
Traceback (most recent call last): File "C:\Python36\kodovi\", line 184, in <module> element = WebDriverWait(browser, 10).until(EC.presence_of_element_located(By .ID, "loadedButton")) TypeError: __init__() takes 2 positional arguments but 3 were given
What am I doing wrong?
you have 'By .ID...'
isn't it BY ID? (no dot)
Missing a couple of ().
element = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, "loadedButton")))
snippsat, correct. Thank you, although I don't understand why do we need double brackets.

Larz, By.ID is correct. it's called Locator.
I use it, senior moment.