Skip to content

Commit b7f8070

Browse files
committed
Added press keys test to demonstrate two keystroke delete
A question was raised in the repo issue noting an apparent failure to clear out a field. The user used `COMMAND+A+BACKSPACE` to do this. This is incorrect in that this does a single combined kepypress, pressing the backspace while holding/pressing the command+a. Instead it should be two separate keystrokes. First a the select all (`COMMAND+A`) and then in a separate argument the delete, as in ``` Press Keys COMMAND+A BACKSPACE ``` This commit always shows an interesting issue with getting the changed text from the text area. In this commit one should see the commented out Element Text Should Be calls. Their removal is due to the fact these were failing. The text was remaining the same. There are a couple reasons why this was the case. First for text area I believe the text is in the value property instead of the text. Second is that one must query the property as a property can change whereas the DOM attribute is that which is coded. So if one replaces `Get Property` with `Get DOM Attribute` the test will fail again as the DOM attribute does not change. it is what the page was coded with. But the value property does. This is an interesting exercise in learning a few aspects of html, selenium, and debugging.
1 parent 0c99a6d commit b7f8070

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

atest/acceptance/keywords/press_keys.robot

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ Press Keys Without Element Special Keys
9595
Click Button OK
9696
Wait Until Page Contains Please input text and click the button. Text will appear in the page. timeout=3
9797

98+
Press Keys To Delete Text
99+
[Setup] Go To Page "forms/prefilled_email_form.html"
100+
# check first text is there
101+
Element Text Should Be comment Prefilled text area
102+
${text}= Get Property comment value
103+
Should Be Equal ${text} Prefilled text area
104+
# Press Keys comment ${CTRL_OR_COMMAND}+A BACKSPACE
105+
Press Keys comment BACKSPACE
106+
Sleep 2secs
107+
# Element Text Should Be comment ${EMPTY}
108+
${text}= Get Property comment value
109+
Should Be Equal ${text} Prefilled text are
110+
98111
*** Keywords ***
99112
CTRL Or Command Key
100113
${CTRL_OR_COMMAND} = Ctrl Or Command Key

0 commit comments

Comments
 (0)