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

How can I handle errors for the elements p.MustElement #657

Closed
vipulsingh24 opened this issue Jul 14, 2022 · 5 comments
Closed

How can I handle errors for the elements p.MustElement #657

vipulsingh24 opened this issue Jul 14, 2022 · 5 comments
Labels
question Questions related to rod

Comments

@vipulsingh24
Copy link

vipulsingh24 commented Jul 14, 2022

Rod Version: v0.107.3

Looking to handle the error or panic in case the element not found or something else want wrong, while selecting or clicking an element.

For example, in page.MustElement if frame not found
pF := page.MustElement("#selector_name").MustFrame()

or while clicking a button, I see there were errors like panic: element has no visible shape or outside the viewport: <#selector_name>
pF.MustElement("#selector_name").MustClick()

@vipulsingh24 vipulsingh24 added the question Questions related to rod label Jul 14, 2022
@rod-robot
Copy link

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

Please fix the format of your markdown:

11 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]

generated by check-issue

@ysmood
Copy link
Member

ysmood commented Jul 15, 2022

Because

element has no visible shape or outside the viewport

How to click button that is not visible on the page?

Maybe your selector seclects a wrong button.

@ysmood
Copy link
Member

ysmood commented Jul 21, 2022

#322

@ysmood ysmood closed this as not planned Won't fix, can't repro, duplicate, stale Jul 21, 2022
@vipulsingh24
Copy link
Author

Yes @ysmood , so is there any way I can handle it. How should I check is that element present in the html or not?

@ysmood
Copy link
Member

ysmood commented Jul 25, 2022

rod/element.go

Lines 143 to 146 in 4bbedf8

// Interactable checks if the element is interactable with cursor.
// The cursor can be mouse, finger, stylus, etc.
// If not interactable err will be ErrNotInteractable, such as when covered by a modal,
func (el *Element) Interactable() (pt *proto.Point, err error) {

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

3 participants