New Keyword 'Element Attriubte Should Contain'
See original GitHub issueCopied from ExtendeSelenium2Library:
@keyword
def element_attribute_should_contain(self, attribute_locator, expected, message=''):
"""Verifies element attribute identified by ``attribute_locator`` contains ``expected``.
Arguments:
- ``attribute_locator``: The locator to find requested element attribute. It consists of
element locator followed by an @ sign and attribute name,
for example "element_id@class".
- ``expected``: The expected element attribute value.
- ``message``: The value that would be use to override the default error message.
Examples:
| Element Attribute Should Contain | css=div.class@class | value |
"""
actual = self.get_element_attribute(attribute_locator)
if expected not in actual:
if not message:
message = "Element attribute '%s' should have contained '%s'" \
" but its value was '%s'." % (attribute_locator, expected, actual)
raise AssertionError(message)
#And the negation:
@keyword
def element_attribute_should_not_contain(self, attribute_locator, unexpected, message=''):
"""Verifies element attribute identified by ``attribute_locator``
does not contain ``unexpected``.
Arguments:
- ``attribute_locator``: The locator to find requested element attribute. It consists of
element locator followed by an @ sign and attribute name,
for example "element_id@class".
- ``unexpected``: The unexpected element attribute value.
- ``message``: The value that would be use to override the default error message.
Examples:
| Element Attribute Should Not Contain | css=div.class@class | value |
"""
actual = self.get_element_attribute(attribute_locator)
if unexpected in actual:
if not message:
message = "Element attribute '%s' should not contain '%s'" \
" but it did." % (attribute_locator, unexpected)
raise AssertionError(message)
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
SeleniumLibrary
All keywords support finding elements based on id and name attributes, but some keywords support additional attributes or other values that make ...
Read more >How to use "Run Keywork If" and "Get Element Attribute" in ...
Let me know what happens. I'm guessing elementPresent will contain only true or false? Ah sorry I just read further, so basically your...
Read more >XML library | Robocorp documentation
The element to whom to add the new element is specified using source and xpath . They have exactly the same semantics as...
Read more >AppiumLibrary - GitHub Pages
New in AppiumLibrary 1.4, id and xpath are not required to be ... In contrast to Element Should Contain Text, this keyword does...
Read more >Keyword Documentation - Robot Framework Hub
Keywords Arguments Documentation
Add Location Strategy strategy_name, strategy_keyword, persist=False
Capture Page Screenshot filename=selenium‑screenshot‑.png
Close Browser Closes the curr...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Plus, my team has already added
Element Attribute Value Should Be
- https://github.com/robotframework/SeleniumLibrary/blob/master/src/SeleniumLibrary/keywords/element.py#L387On Fri, May 25, 2018 at 3:39 AM, Pekka Klärck notifications@github.com wrote:
– Ruby: http://blog.rubygeek.com - http://www.twitter.com/rubygeek http://www.linkedin.com/in/nolastowe - my linkedin profile http://github.com/rubygeek - my code
I can see ES2L supporting the latest SL being useful to many, but, to be honest, if the reason E2SL exists is to just add new generic functionality to SL, I don’t see the point of the library in general. Much better concentrating efforts to SL only.
The situation with AngularLibrary is different because it is designed to a specific domain and adds non-generic functionality on top of SL. Having a way such functionality could be added to SL via plugins might be even better, but that would first require designing and implementing the plugin API.