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

Search Function doesn't return anything in 10 minutes #361

Closed
xtianpu opened this issue Feb 28, 2021 · 5 comments
Closed

Search Function doesn't return anything in 10 minutes #361

xtianpu opened this issue Feb 28, 2021 · 5 comments
Labels
needs info The description is not enough to tackle the problem

Comments

@xtianpu
Copy link

xtianpu commented Feb 28, 2021

Rod Version: v0.94.0

Steps to reproduce

page := browser.MustPage("https://somewebsite.com/login?lang=en").MustWaitLoad()
	page.MustElement(`input[name="session[username_or_email]"]`).MustInput(screenName)
	page.MustElement(`input[name="session[password]"]`).MustInput(password)
	page.Keyboard.MustPress(input.Enter)
	time.Sleep(time.Second * 1)
	page.MustReload()
	pageInfo := page.MustInfo()

_, err := page.Search(0, 1, userId)
	if err != nil { return false }
  • What did you do?
    I just want search a simple string containing user id on html page, using page.Search(0, 1, userId), I think this function work on version 0.8x.00

  • What have you tried to solve the problem?
    html, _ := page.HTML() if !strings.Contains(html, userId){ return false }

Expected behavior

Returning status if HTML contained desired User ID

Actual result

Please see this error log
pagesearch.log

@xtianpu xtianpu added the bug When you are sure about it's a bug label Feb 28, 2021
@ysmood ysmood added needs info The description is not enough to tackle the problem and removed bug When you are sure about it's a bug labels Feb 28, 2021
@ysmood
Copy link
Collaborator

ysmood commented Feb 28, 2021

Can you provide minimal code for us to reproduce your issue?

Works fine for me:

rod/examples_test.go

Lines 196 to 208 in deea7a7

func Example_search() {
browser := rod.New().MustConnect()
defer browser.MustClose()
page := browser.MustPage("https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe")
// Click the zoom-in button of the OpenStreetMap
page.MustSearch(".leaflet-control-zoom-in").MustClick()
fmt.Println("done")
// Output: done
}

@ysmood
Copy link
Collaborator

ysmood commented Feb 28, 2021

Close because of #322

@ysmood ysmood closed this as completed Feb 28, 2021
@xtianpu
Copy link
Author

xtianpu commented Feb 28, 2021

Hi ysmood, it was Search not MustSearch.

https://pkg.go.dev/github.com/go-rod/rod#Page.Search

@ysmood
Copy link
Collaborator

ysmood commented Feb 28, 2021

Hi ysmood, it was Search not MustSearch.

https://go-rod.github.io/#/error-handling?id=error-handling

@xtianpu
Copy link
Author

xtianpu commented Mar 1, 2021

My bad I will reformat this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info The description is not enough to tackle the problem
Projects
None yet
Development

No branches or pull requests

2 participants