Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WebDriverWait
#1
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 selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC  
import time
options = Options()
options.add_argument("--headless")
caps = webdriver.DesiredCapabilities().FIREFOX
caps["marionette"] = True
browser = webdriver.Firefox(firefox_options=options, capabilities=caps, executable_path=r"geckodriver.exe")
browser.get("http://pythonscraping.com/pages/javascript/ajaxDemo.html")
try:
	element = WebDriverWait(browser, 10).until(EC.presence_of_element_located(By.ID, "loadedButton"))
finally:
	print(browser.find_element_by_id("content").text)
	browser.close()
Error:
Traceback (most recent call last): File "C:\Python36\kodovi\wbp.py", 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?
Reply


Messages In This Thread
WebDriverWait - by Truman - Mar-25-2019, 01:07 AM
RE: WebDriverWait - by Larz60+ - Mar-25-2019, 02:47 AM
RE: WebDriverWait - by snippsat - Mar-25-2019, 09:07 AM
RE: WebDriverWait - by Truman - Mar-25-2019, 10:50 PM
RE: WebDriverWait - by Larz60+ - Mar-26-2019, 09:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  WebDriverWait improved function euras 0 1,519 Jun-02-2021, 01:40 PM
Last Post: euras
  WebDriverWait visibility isnt defined gr3yali3n 0 1,566 Oct-26-2020, 02:54 AM
Last Post: gr3yali3n

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020