Python Forum
[Selenium] Element Visible / Invisible | Delay - Best Settings?
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Selenium] Element Visible / Invisible | Delay - Best Settings?
#1
I have this snippet of code that delays the script from moving forward until images are done uploading to a website.

WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, '//DIV[@class="spinner animation"]')))
WebDriverWait(driver, 20).until(EC.invisibility_of_element_located((By.XPATH, '//DIV[@class="spinner animation"]')))
What settings would you guys use? Is there any better option than a fixed time(driver, 20)? I've been playing around with the settings but it doesn't really run smoothly.
Reply
#2
What do you mean it doesnt run smoothly?
Recommended Tutorials:
Reply
#3
(Nov-19-2017, 02:48 PM)metulburr Wrote: What do you mean it doesnt run smoothly?

Just way too much delay.

I think I maybe just need this one line:
WebDriverWait(driver, 1).until(EC.invisibility_of_element_located((By.XPATH, '//DIV[@class="spinner animation"]')))
But even with this one line, and the setting (driver, 1) it delays for 15 seconds after the element has visibly disappeared in the browser. It does move on eventually but I'm confused why it's hanging.

What exactly does this number 1 do? (driver, 1)

Sleep for a 1 second wait until invisibility of element or else just move on?

Wait indefinitely until invisibility of element then sleep 1 second?

Something else?

-

EDIT: this maybe my fault - the site I'm working on is doing a good job hiding the spinner element. all I could grab was the class, I'm not able to hook into anything else to test if that would help.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Selenium suddenly fails to find element Pavel_47 3 6,198 Sep-04-2022, 11:06 AM
Last Post: Pavel_47
  Azure Function App Configuration Settings jdb1234 1 2,082 Oct-16-2020, 10:54 AM
Last Post: ndc85430
  Clicking on element not triggering event in Selenium Python (Event Key is not in data dkaeloredo 2 4,230 Feb-16-2020, 05:50 AM
Last Post: dkaeloredo
  Selenium locating an element. JokerTux 3 2,639 Dec-28-2019, 08:50 AM
Last Post: snippsat
  Selenium returning web element instead of desired text newbie_programmer 1 5,142 Dec-11-2019, 06:37 AM
Last Post: Malt
  Scraping with some delay Truman 3 3,012 Jun-10-2019, 12:00 AM
Last Post: metulburr
  How to get visible text of Select Drop down ankitjindalbti 2 2,709 Jun-03-2019, 12:35 AM
Last Post: ankitjindalbti
  Web connection delay ebolisa 5 2,956 Apr-23-2019, 11:07 AM
Last Post: DeaD_EyE
  Python Selenium getting table element trengan 2 8,505 Dec-31-2018, 03:02 PM
Last Post: trengan
  Click Element if displayed using Selenium and Python giaco__mar 1 3,486 Dec-27-2018, 06:19 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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