File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
atest/acceptance/keywords
src/SeleniumLibrary/keywords Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ Get Element Attribute
6262
6363Get Element Attribute Value Should Be Should Be Succesfull
6464 Element Attribute Value Should Be link=Absolute external link href http://www.google.com/
65+ Element Attribute Value Should Be link=Absolute external link nothere None
66+
6567
6668Get Element Attribute And Element Attribute Value Should Be Should have same results
6769 ${attribute_value } = Get Element Attribute css=#second_div class
@@ -70,12 +72,12 @@ Get Element Attribute And Element Attribute Value Should Be Should have same res
7072Get Element Attribute Value Should Be Should Be Succesfull with non-ascii characters
7173 Element Attribute Value Should Be link=Link with Unicode äöüÄÖÜß href http://localhost:7000/html/index.html
7274
73- Get Element Attribute Value Should Be Should Be Succesfull error and errors messages
75+ Get Element Attribute Value Should Be Should Be Succesfull error and error messages
7476 Run Keyword And Expect Error
7577 ... Test Fail Custom Message
7678 ... Element Attribute Value Should Be id=image_id href http://non_existing.com message=Test Fail Custom Message
7779 Run Keyword And Expect Error
78- ... Element 'id=image_id' attribute should have value 'http://non_existing.com' but its value was 'None'.
80+ ... Element 'id=image_id' attribute should have value 'http://non_existing.com (str) ' but its value was 'None' (nonetype) .
7981 ... Element Attribute Value Should Be id=image_id href http://non_existing.com
8082 Run Keyword And Expect Error
8183 ... Element with locator 'id=non_existing' not found.
Original file line number Diff line number Diff line change 2525
2626from SeleniumLibrary .base import LibraryComponent , keyword
2727from SeleniumLibrary .errors import ElementNotFound
28+ from SeleniumLibrary .utils .types import type_converter
2829
2930
3031class ElementKeywords (LibraryComponent ):
@@ -414,7 +415,7 @@ def element_attribute_value_should_be(
414415 self ,
415416 locator : Union [WebElement , str ],
416417 attribute : str ,
417- expected : str ,
418+ expected : Union [ None , str ] ,
418419 message : Optional [str ] = None ,
419420 ):
420421 """Verifies element identified by ``locator`` contains expected attribute value.
@@ -431,8 +432,9 @@ def element_attribute_value_should_be(
431432 if current_expected != expected :
432433 if message is None :
433434 message = (
434- f"Element '{ locator } ' attribute should have value '{ expected } ' but "
435- f"its value was '{ current_expected } '."
435+ f"Element '{ locator } ' attribute should have value '{ expected } "
436+ f"({ type_converter (expected )} )' but its value was '{ current_expected } ' "
437+ f"({ type_converter (current_expected )} )."
436438 )
437439 raise AssertionError (message )
438440 self .info (
You can’t perform that action at this time.
0 commit comments