-
Notifications
You must be signed in to change notification settings - Fork 784
New attribute property keywords 1822 #1850
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
Merged
emanlove
merged 11 commits into
robotframework:master
from
emanlove:new-attribute-property-keywords-1822
Dec 19, 2023
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bbcc837
Initial commit adding keywords and tests for #1822
emanlove ce741a7
Added another atest to check for "attibute" that is both an attribute
emanlove 568009c
Merge branch 'update-test-under-python-versions' into new-attribute-p…
emanlove 5da9e12
Updated documentation for expected value if attribute is not there
emanlove b300761
Cleaned up Get DOM Attribute, Get Property atests
emanlove 4a1f413
Updated number of library keywords to 179
emanlove 6af2c82
Revert "Updated number of library keywords to 179"
emanlove bbb9990
Updated number of library keywords to 179
emanlove 41ca7f7
Merge branch 'master' into new-attribute-property-keywords-1822
emanlove 7ab0a2c
Added test where the property is different than the attribute
emanlove 085fc64
Merge branch 'master' into new-attribute-property-keywords-1822
emanlove File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ Documentation Tests elements | |
| Test Setup Go To Page "links.html" | ||
| Resource ../resource.robot | ||
| Library String | ||
| Library DebugLibrary | ||
|
|
||
| *** Test Cases *** | ||
| Get Many Elements | ||
|
|
@@ -60,6 +61,92 @@ Get Element Attribute | |
| ${class}= Get Element Attribute ${second_div} class | ||
| Should Be Equal ${class} Second Class | ||
|
|
||
| # About DOM Attributes and Properties | ||
| # ----------------------------------- | ||
| # When implementing the new `Get DOM Attirbute` and `Get Property` keywords (#1822), several | ||
| # questions were raised. Fundamentally what is the difference between a DOM attribute and | ||
| # a Property. As [1] explains "Attributes are defined by HTML. Properties are defined by the | ||
| # DOM (Document Object Model)." | ||
| # | ||
| # Below are some references which talk to some descriptions and oddities of DOM attributes | ||
| # and properties. | ||
| # | ||
| # References: | ||
| # [1] HTML attributes and DOM properties: | ||
| # https://angular.io/guide/binding-syntax#html-attribute-vs-dom-property | ||
| # [2] W3C HTML Specification - Section 13.1.2.3 Attributes: | ||
| # https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 | ||
| # [3] JavaScript.Info - Attributes and properties: | ||
| # https://javascript.info/dom-attributes-and-properties | ||
| # [4] "Which CSS properties are inherited?" - StackOverflow | ||
| # https://stackoverflow.com/questions/5612302/which-css-properties-are-inherited | ||
| # [5] MDN Web Docs: Attribute | ||
| # https://developer.mozilla.org/en-US/docs/Glossary/Attribute | ||
| # [6] MDN Web Docs: HTML attribute reference | ||
| # https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | ||
|
|
||
| Get DOM Attribute | ||
| # Test get DOM attribute | ||
| ${id}= Get DOM Attribute link:Link with id id | ||
| Should Be Equal ${id} some_id | ||
| # Test custom attribute | ||
| ${existing_custom_attr}= Get DOM Attribute id:emptyDiv data-id | ||
| Should Be Equal ${existing_custom_attr} my_id | ||
| ${doesnotexist_custom_attr}= Get DOM Attribute id:emptyDiv data-doesnotexist | ||
| Should Be Equal ${doesnotexist_custom_attr} ${None} | ||
| # Get non existing DOM Attribute | ||
| ${class}= Get DOM Attribute link:Link with id class | ||
| Should Be Equal ${class} ${NONE} | ||
|
|
||
| More DOM Attributes | ||
| [Setup] Go To Page "forms/enabled_disabled_fields_form.html" | ||
| # Test get empty boolean attribute | ||
| ${disabled}= Get DOM Attribute css:input[name="disabled_input"] disabled | ||
| Should Be Equal ${disabled} true | ||
| # Test boolean attribute whose value is a string | ||
| ${disabled}= Get DOM Attribute css:input[name="disabled_password"] disabled | ||
| Should Be Equal ${disabled} true | ||
| # Test empty string as the value for the attribute | ||
| ${empty_value}= Get DOM Attribute css:input[name="disabled_password"] value | ||
| Should Be Equal ${empty_value} ${EMPTY} | ||
| # Test non-existing attribute | ||
| ${disabled}= Get DOM Attribute css:input[name="enabled_password"] disabled | ||
| Should Be Equal ${disabled} ${NONE} | ||
|
|
||
| Get Property | ||
| [Setup] Go To Page "forms/enabled_disabled_fields_form.html" | ||
| ${tagName_prop}= Get Property css:input[name="readonly_empty"] tagName | ||
| Should Be Equal ${tagName_prop} INPUT | ||
| # Get a boolean property | ||
| ${isConnected}= Get Property css:input[name="readonly_empty"] isConnected | ||
| Should Be Equal ${isConnected} ${True} | ||
| # Test property which returns webelement | ||
| ${children_prop}= Get Property id:table1 children | ||
| Length Should Be ${children_prop} ${1} | ||
| ${isWebElement}= Evaluate isinstance($children_prop[0], selenium.webdriver.remote.webelement.WebElement) modules=selenium | ||
| Should Be Equal ${isWebElement} ${True} | ||
| # ToDo: need to test own versus inherited property | ||
| # ToDo: Test enumerated property | ||
|
|
||
| Get "Attribute" That Is Both An DOM Attribute and Property | ||
emanlove marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| [Setup] Go To Page "forms/enabled_disabled_fields_form.html" | ||
| ${value_property}= Get Property css:input[name="readonly_empty"] value | ||
| ${value_attribute}= Get DOM Attribute css:input[name="readonly_empty"] value | ||
| Should Be Equal ${value_property} ${value_attribute} | ||
|
|
||
| Modify "Attribute" That Is Both An DOM Attribute and Property | ||
| [Setup] Go To Page "forms/prefilled_email_form.html" | ||
| ${initial_value_property}= Get Property css:input[name="email"] value | ||
| ${initial_value_attribute}= Get DOM Attribute css:input[name="email"] value | ||
| Should Be Equal ${initial_value_property} ${initial_value_attribute} | ||
| Should Be Equal ${initial_value_attribute} Prefilled Email | ||
| Input Text css:input[name="email"] [email protected] | ||
| ${changed_value_property}= Get Property css:input[name="email"] value | ||
| ${changed_value_attribute}= Get DOM Attribute css:input[name="email"] value | ||
| Should Not Be Equal ${changed_value_property} ${changed_value_attribute} | ||
| Should Be Equal ${changed_value_attribute} Prefilled Email | ||
| Should Be Equal ${changed_value_property} [email protected] | ||
|
|
||
| Get Element Attribute Value Should Be Should Be Succesfull | ||
| Element Attribute Value Should Be link=Absolute external link href http://www.google.com/ | ||
| Element Attribute Value Should Be link=Absolute external link nothere ${None} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.