-
-
Notifications
You must be signed in to change notification settings - Fork 155
Closed
Description
This is a follow on question from the discussion in #122, in the discussion, there's a great recommendation:
If request is to external server try to block such if it's not vital part of your app
However, it is not clear to me what is the best way to do this. At first, I added helper methods that looked at each frame to make sure that it was done loading. For one of my pages, this is sufficient and I never have a pending connections errors. However, on another page that I'm loading, this often isn't enough. I think it's still downloading images. At first, I put a sleep 10 but have had to slowly grow it to sleep 40
Is there a better API to ask ferrum if my code should keep waiting?
def done_loading(browser)
states = browser.frames.collect do |frame|
frame.state
end
states = states.uniq
states == [:stopped_loading]
end
def wait_for_done_loading(browser)
while !done_loading(browser)
sleep 1
end
sleep 2 #allows javascript to "settle down"
endMetadata
Metadata
Assignees
Labels
No labels