From d34b5562f29960f9dbd8352374e5d81714842977 Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Sat, 18 Jul 2015 13:05:45 +0200 Subject: [PATCH 01/13] add keyword input_text_into_prompt add keyword input_text_into_prompt ( example from boakley ) fixes issue #292 "Add ability to type into a prompt" --- src/Selenium2Library/keywords/_formelement.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Selenium2Library/keywords/_formelement.py b/src/Selenium2Library/keywords/_formelement.py index 22065b393..7e67e8f6c 100644 --- a/src/Selenium2Library/keywords/_formelement.py +++ b/src/Selenium2Library/keywords/_formelement.py @@ -197,6 +197,15 @@ def input_text(self, locator, text): self._info("Typing text '%s' into text field '%s'" % (text, locator)) self._input_text_into_text_field(locator, text) + def input_text_into_prompt(self, text): + """Types the given `text` into alert box. """ + alert = None + try: + alert = self._current_browser().switch_to_alert() + alert.send_keys(text) + except WebDriverException: + raise RuntimeError('There were no alerts') + def page_should_contain_textfield(self, locator, message='', loglevel='INFO'): """Verifies text field identified by `locator` is found from current page. From 143742deb858d15c5327964a3a1e7e43fe5e11f1 Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 13:07:24 +0200 Subject: [PATCH 02/13] create test for iput text into prompt --- test/acceptance/keywords/input_text_into_prompt.robot | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/acceptance/keywords/input_text_into_prompt.robot diff --git a/test/acceptance/keywords/input_text_into_prompt.robot b/test/acceptance/keywords/input_text_into_prompt.robot new file mode 100644 index 000000000..4c5070293 --- /dev/null +++ b/test/acceptance/keywords/input_text_into_prompt.robot @@ -0,0 +1,11 @@ +*Setting* +Variables variables.py +Resource ../resource.robot +Test Setup Go To Page "forms/login_alert.html" + + +*Test Cases* + +Input Password into AlertPrompt + [Documentation] LOG 3 Typing password into alertprompt 'password_field' + Input Text Into Prompt password From 2e9c116a2cabc1ef2385373261086cb9d71fc49b Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 13:09:53 +0200 Subject: [PATCH 03/13] Create password_prompt.html Create password_prompt --- .../resources/html/forms/password_prompt.html | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/resources/html/forms/password_prompt.html diff --git a/test/resources/html/forms/password_prompt.html b/test/resources/html/forms/password_prompt.html new file mode 100644 index 000000000..74c8218ca --- /dev/null +++ b/test/resources/html/forms/password_prompt.html @@ -0,0 +1,23 @@ + + + + +

Click the button to demonstrate the prompt box.

+ + + +

+ + + + + From d0ceff49babb69cdb0625c7af995728ed508edd7 Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 13:13:42 +0200 Subject: [PATCH 04/13] Create password_prompt.html Create password_prompt.html --- .../html/javascript/password_prompt.html | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/resources/html/javascript/password_prompt.html diff --git a/test/resources/html/javascript/password_prompt.html b/test/resources/html/javascript/password_prompt.html new file mode 100644 index 000000000..74c8218ca --- /dev/null +++ b/test/resources/html/javascript/password_prompt.html @@ -0,0 +1,23 @@ + + + + +

Click the button to demonstrate the prompt box.

+ + + +

+ + + + + From ad67c8637f9ea385022d2e0ae85881a55e2defb4 Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 13:13:57 +0200 Subject: [PATCH 05/13] Delete password_prompt.html --- .../resources/html/forms/password_prompt.html | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 test/resources/html/forms/password_prompt.html diff --git a/test/resources/html/forms/password_prompt.html b/test/resources/html/forms/password_prompt.html deleted file mode 100644 index 74c8218ca..000000000 --- a/test/resources/html/forms/password_prompt.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - -

Click the button to demonstrate the prompt box.

- - - -

- - - - - From ce76e5018fe91e57efcd4a759033d9eda9c072b5 Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 13:19:44 +0200 Subject: [PATCH 06/13] Update input_text_into_prompt.robot Add testcase for input text into prompt --- test/acceptance/keywords/input_text_into_prompt.robot | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/acceptance/keywords/input_text_into_prompt.robot b/test/acceptance/keywords/input_text_into_prompt.robot index 4c5070293..8c814a1df 100644 --- a/test/acceptance/keywords/input_text_into_prompt.robot +++ b/test/acceptance/keywords/input_text_into_prompt.robot @@ -1,11 +1,13 @@ *Setting* Variables variables.py Resource ../resource.robot -Test Setup Go To Page "forms/login_alert.html" +Test Setup Go To Page "javascript/password_prompt.html" *Test Cases* -Input Password into AlertPrompt - [Documentation] LOG 3 Typing password into alertprompt 'password_field' - Input Text Into Prompt password +Verify Input Text into Prompt + [Documentation] Typing name into prompt + Click Element id=demo + Input Text Into Prompt myname + Page Should Contain myname From 86a28991ff81c937e27a63bfd2cd941dbe13ceee Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 13:29:39 +0200 Subject: [PATCH 07/13] Delete input_text_into_prompt.robot --- .../keywords/input_text_into_prompt.robot | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 test/acceptance/keywords/input_text_into_prompt.robot diff --git a/test/acceptance/keywords/input_text_into_prompt.robot b/test/acceptance/keywords/input_text_into_prompt.robot deleted file mode 100644 index 8c814a1df..000000000 --- a/test/acceptance/keywords/input_text_into_prompt.robot +++ /dev/null @@ -1,13 +0,0 @@ -*Setting* -Variables variables.py -Resource ../resource.robot -Test Setup Go To Page "javascript/password_prompt.html" - - -*Test Cases* - -Verify Input Text into Prompt - [Documentation] Typing name into prompt - Click Element id=demo - Input Text Into Prompt myname - Page Should Contain myname From 50c9e716a8b4ebd464d2004aa99f83d87037b24d Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 13:29:55 +0200 Subject: [PATCH 08/13] Delete password_prompt.html --- .../html/javascript/password_prompt.html | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 test/resources/html/javascript/password_prompt.html diff --git a/test/resources/html/javascript/password_prompt.html b/test/resources/html/javascript/password_prompt.html deleted file mode 100644 index 74c8218ca..000000000 --- a/test/resources/html/javascript/password_prompt.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - -

Click the button to demonstrate the prompt box.

- - - -

- - - - - From de529d691cd015e66913f61b4f62e24319471bc4 Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 13:44:32 +0200 Subject: [PATCH 09/13] Create alert_prompt.html --- .../html/javascript/alert_prompt.html | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/resources/html/javascript/alert_prompt.html diff --git a/test/resources/html/javascript/alert_prompt.html b/test/resources/html/javascript/alert_prompt.html new file mode 100644 index 000000000..74c8218ca --- /dev/null +++ b/test/resources/html/javascript/alert_prompt.html @@ -0,0 +1,23 @@ + + + + +

Click the button to demonstrate the prompt box.

+ + + +

+ + + + + From f2d17e30549a9f31f14f1f19a8ce7864a026f74d Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 13:45:40 +0200 Subject: [PATCH 10/13] Create input_text_into_prompt.robot --- .../keywords/input_text_into_prompt.robot | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/acceptance/keywords/input_text_into_prompt.robot diff --git a/test/acceptance/keywords/input_text_into_prompt.robot b/test/acceptance/keywords/input_text_into_prompt.robot new file mode 100644 index 000000000..8c814a1df --- /dev/null +++ b/test/acceptance/keywords/input_text_into_prompt.robot @@ -0,0 +1,13 @@ +*Setting* +Variables variables.py +Resource ../resource.robot +Test Setup Go To Page "javascript/password_prompt.html" + + +*Test Cases* + +Verify Input Text into Prompt + [Documentation] Typing name into prompt + Click Element id=demo + Input Text Into Prompt myname + Page Should Contain myname From c23005c0ad97227349ac3c1653c79851bcfb3cb4 Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 13:55:26 +0200 Subject: [PATCH 11/13] Update input_text_into_prompt.robot --- test/acceptance/keywords/input_text_into_prompt.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/acceptance/keywords/input_text_into_prompt.robot b/test/acceptance/keywords/input_text_into_prompt.robot index 8c814a1df..d8d356263 100644 --- a/test/acceptance/keywords/input_text_into_prompt.robot +++ b/test/acceptance/keywords/input_text_into_prompt.robot @@ -1,13 +1,13 @@ *Setting* Variables variables.py Resource ../resource.robot -Test Setup Go To Page "javascript/password_prompt.html" +Test Setup Go To Page "javascript/alert_prompt.html" *Test Cases* Verify Input Text into Prompt [Documentation] Typing name into prompt - Click Element id=demo + Click Element css=button Input Text Into Prompt myname Page Should Contain myname From 56f30367760ac63ef2e7f15bea2da5d5d413fef4 Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 20:30:30 +0200 Subject: [PATCH 12/13] Add test for keyword Input Text Into Prompt Add test for keyword Input Text Into Prompt --- test/acceptance/keywords/input_text_into_prompt.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/acceptance/keywords/input_text_into_prompt.robot b/test/acceptance/keywords/input_text_into_prompt.robot index d8d356263..68078a0ad 100644 --- a/test/acceptance/keywords/input_text_into_prompt.robot +++ b/test/acceptance/keywords/input_text_into_prompt.robot @@ -10,4 +10,4 @@ Verify Input Text into Prompt [Documentation] Typing name into prompt Click Element css=button Input Text Into Prompt myname - Page Should Contain myname + Get Alert Message From 9dbf61ca4f395e42ddff87bd0ec284854dee8035 Mon Sep 17 00:00:00 2001 From: Evert Kasteel Date: Tue, 21 Jul 2015 20:49:28 +0200 Subject: [PATCH 13/13] Added new keyword Input Text Into Prompt Added new keyword Input Text Into Prompt (example from boakley). Fixes #292 --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 36dab2508..f78553356 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,8 @@ Release Notes ============= +- Added new keyword Input Text Into Prompt [boakley][ekasteel] + 1.7.2 ---------------- - Fixed an error where regular functions were not able to be used as a custom locator