Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElementX stuck if you specify a non-existent element #1002

Closed
DimaRQ opened this issue Jan 11, 2024 · 2 comments
Closed

ElementX stuck if you specify a non-existent element #1002

DimaRQ opened this issue Jan 11, 2024 · 2 comments
Labels
question Questions related to rod

Comments

@DimaRQ
Copy link

DimaRQ commented Jan 11, 2024

Sometimes there is no element on the site //*[text()='AGREE'], then the code gets stuck in the "ElementByJS" function, as far as I understand, it does not have a timeout

el, err := page.ElementX(xpath)

v0.114.5

@DimaRQ DimaRQ added the enhance New feature or request label Jan 11, 2024
@DimaRQ DimaRQ changed the title ElementX hangs if you specify a non-existent element ElementX stuck if you specify a non-existent element Jan 11, 2024
Copy link

Please add a valid Rod Version: v0.0.0 to your issue. Current version is v0.114.5

generated by check-issue

@ysmood ysmood added question Questions related to rod and removed enhance New feature or request labels Jan 12, 2024
@ysmood
Copy link
Member

ysmood commented Jan 12, 2024

Please look at the word retries in its doc, I think it's clear:

rod/query.go

Lines 152 to 154 in 310be6f

// ElementX retries until an element in the page that matches one of the XPath selectors, then returns
// the matched element.
func (p *Page) ElementX(xPath string) (*Element, error) {

Also about timeout:

https://go-rod.github.io/#/context-and-timeout

@ysmood ysmood closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions related to rod
Projects
None yet
Development

No branches or pull requests

2 participants