Skip to content

Commit a2dcc55

Browse files
committed
fix: Series.Add-Comment.Validation.Add a blank comment: StaleElementReferenceException: Message: stale element reference: stale element not found in the current frame
1 parent 209aa5d commit a2dcc55

2 files changed

Lines changed: 21 additions & 13 deletions

File tree

src/test/robotframework/selenium.utils.robot

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ Wait Until Element Value Is
5050
... ';
5151
Wait For Condition ${elemHasValue}
5252

53+
Wait Until Element Text Is
54+
[Documentation] Hybrid of "Wait Until Page Contains Element" and "Element Text Should Be" keywords
55+
[Arguments] ${id} ${text}
56+
${elemHasText}= Catenate SEPARATOR=
57+
... var el = window.document.getElementById('
58+
... ${id}
59+
... '); return el != null && el.innerText == '
60+
... ${text}
61+
... ';
62+
Wait For Condition ${elemHasText}
63+
5364
Select Random Option From List
5465
[Documentation] Choose a random option from a select element
5566
[Arguments] ${locator}

src/test/robotframework/series/add-comment/validation.robot

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,20 @@ Force Tags series add-comment validation
99

1010
*** Test Cases ***
1111
Add comment with empty required field
12-
[Setup] Disable Client Validation add-comment-form
13-
Submit Form id:add-comment-form
14-
Wait Until Page Contains Element id:new-comment.errors
15-
Element Text Should Be id:new-comment.errors Value must not be empty
12+
[Setup] Disable Client Validation add-comment-form
13+
Submit Form id:add-comment-form
14+
Wait Until Element Text Is new-comment.errors Value must not be empty
1615

1716
Add a blank comment
18-
Input Text id:new-comment ${SPACE}${SPACE}
19-
Submit Form id:add-comment-form
20-
Wait Until Page Contains Element id:new-comment.errors
21-
Element Text Should Be id:new-comment.errors Value must not be empty
17+
Input Text id:new-comment ${SPACE}${SPACE}
18+
Submit Form id:add-comment-form
19+
Wait Until Element Text Is new-comment.errors Value must not be empty
2220

2321
Add too long comment
24-
${letter}= Set Variable x
25-
Input Text id:new-comment ${letter * 1025}
26-
Submit Form id:add-comment-form
27-
Wait Until Page Contains Element id:new-comment.errors
28-
Element Text Should Be id:new-comment.errors Value is greater than allowable maximum of 1024 characters
22+
${letter}= Set Variable x
23+
Input Text id:new-comment ${letter * 1025}
24+
Submit Form id:add-comment-form
25+
Wait Until Element Text Is new-comment.errors Value is greater than allowable maximum of 1024 characters
2926

3027
*** Keywords ***
3128
Before Test Suite

0 commit comments

Comments
 (0)