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

Add Element.Disabled() and Element.MustDisabled() #799

Merged
merged 1 commit into from Feb 6, 2023
Merged

Add Element.Disabled() and Element.MustDisabled() #799

merged 1 commit into from Feb 6, 2023

Conversation

Jacobinski
Copy link
Contributor

Overview

This change allows users to check if an element is disabled. More information about the disabled attribute can be found at:
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled

Similar methods already exist in other browser automation frameworks. For example, Playwright has elementHandle.isDisabled():
https://playwright.dev/docs/api/class-elementhandle#element-handle-is-disabled

This commit is based on discussions in #798

Testing

  • Unit test go test -run ^TestDisabled$ passes.
  • Code coverage remains at 100%
  • General tests go test fail with one error which appears to be unrelated to this change:
$ go test
parallel test 8
--- FAIL: TestBinarySize (2.67s)
    browser_test.go:287: 10.515625 ⦗not ≤⦘ 10.5
FAIL
exit status 1
FAIL	github.com/go-rod/rod	29.786s

This change allows users to check if an element is disabled. More
information about the disabled attribute can be found at:
  https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled

Similar methods already exist in other browser automation frameworks.
For example, Playwright has `elementHandle.isDisabled()`:
 https://playwright.dev/docs/api/class-elementhandle#element-handle-is-disabled

This commit is based on discussions in #798
@Jacobinski
Copy link
Contributor Author

Jacobinski commented Feb 6, 2023

Please let me know if isDisabled() would be a better method name

Copy link
Collaborator

@ysmood ysmood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@ysmood ysmood enabled auto-merge (squash) February 6, 2023 10:00
@ysmood ysmood disabled auto-merge February 6, 2023 11:27
@ysmood ysmood merged commit 0d0e59e into go-rod:master Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants