Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

add Page.Wait method #163

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

add Page.Wait method #163

wants to merge 2 commits into from

Conversation

storyicon
Copy link

Wait method will cause the browser to spend up to timeout seconds
waiting for the element described by the selector to appear.
Method for testing or crawling Javascript-modified web pages (eg Ajax)
Simple example:
page.Wait(//*[@id="ajax-loaded"], 30)
fmt.Println(page.HTML())

@sclevine
Copy link
Owner

Sorry for the delay!

I think this can be accomplished via the webdriver with page.SetImplicitWait:
https://godoc.org/github.com/sclevine/agouti#Page.SetImplicitWait

That said, I'd consider merging a tested version of this implemented on the Selection or MultiSelection types.

@storyicon
Copy link
Author

I think there is some difference between page.Wait() and page.SetImplicitWait(). page.Wait() is used to block the process and wait for an element to appear. If it does not appear before timeout, it will unblock and return nil.
I am very happy to hear from you because I am a user of agouti and I think it is better than chromedp/chromedp. I once thought that you have given up the maintenance of agouti.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants