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
62
62
63
63
Get Element Attribute Value Should Be Should Be Succesfull
64
64
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
+
65
67
66
68
Get Element Attribute And Element Attribute Value Should Be Should have same results
67
69
${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
70
72
Get Element Attribute Value Should Be Should Be Succesfull with non-ascii characters
71
73
Element Attribute Value Should Be link=Link with Unicode äöüÄÖÜß href http://localhost:7000/html/index.html
72
74
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
74
76
Run Keyword And Expect Error
75
77
... Test Fail Custom Message
76
78
... Element Attribute Value Should Be id=image_id href http://non_existing.com message=Test Fail Custom Message
77
79
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) .
79
81
... Element Attribute Value Should Be id=image_id href http://non_existing.com
80
82
Run Keyword And Expect Error
81
83
... Element with locator 'id=non_existing' not found.
Original file line number Diff line number Diff line change 25
25
26
26
from SeleniumLibrary .base import LibraryComponent , keyword
27
27
from SeleniumLibrary .errors import ElementNotFound
28
+ from SeleniumLibrary .utils .types import type_converter
28
29
29
30
30
31
class ElementKeywords (LibraryComponent ):
@@ -414,7 +415,7 @@ def element_attribute_value_should_be(
414
415
self ,
415
416
locator : Union [WebElement , str ],
416
417
attribute : str ,
417
- expected : str ,
418
+ expected : Union [ None , str ] ,
418
419
message : Optional [str ] = None ,
419
420
):
420
421
"""Verifies element identified by ``locator`` contains expected attribute value.
@@ -431,8 +432,9 @@ def element_attribute_value_should_be(
431
432
if current_expected != expected :
432
433
if message is None :
433
434
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 )} )."
436
438
)
437
439
raise AssertionError (message )
438
440
self .info (
You can’t perform that action at this time.
0 commit comments