Skip to content

Commit f5a32ff

Browse files
committed
Merged with master
2 parents 1ba05a0 + 31c33a3 commit f5a32ff

File tree

7 files changed

+68
-6
lines changed

7 files changed

+68
-6
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: python
2+
sudo: false
23
python:
34
- "2.6"
45
- "2.7"

CHANGES.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ Release Notes
44
1.7.2 (Unreleased)
55
----------------
66
- Added an argument called screenshot_root_directory that can be passed into S2L's
7-
constructor to specify where to store screenshots.
7+
constructor to specify where to store screenshots.
88
[zephraph]
9-
9+
10+
- Added new keyword Input Text Into Prompt
11+
[boakley][ekasteel]
12+
13+
- Fixed issue that caused tests to fail when selenium > 2.26
14+
[hgarus]
15+
1016
- Fixed an error where regular functions were not able to be used as a custom locator
1117
[zephraph]
1218

README.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@ Selenium 2 (WebDriver) library for Robot Framework
22
==================================================
33

44
.. image:: https://api.travis-ci.org/rtomac/robotframework-selenium2library.png
5-
:target: http://travis-ci.org/rtomac/robotframework-selenium2library
5+
:target: http://travis-ci.org/rtomac/robotframework-selenium2library
66

7-
.. image:: https://pypip.in/v/robotframework-selenium2library/badge.png
8-
:target: https://crate.io/packages/robotframework-selenium2library
7+
.. image:: https://img.shields.io/pypi/v/robotframework-selenium2library.svg
8+
:target: https://pypi.python.org/pypi/robotframework-selenium2library
9+
10+
.. image:: https://img.shields.io/pypi/dm/robotframework-selenium2library.svg
11+
:target: https://pypi.python.org/pypi/robotframework-selenium2library
12+
13+
.. image:: https://img.shields.io/pypi/l/robotframework-selenium2library.svg
14+
:target: http://www.apache.org/licenses/LICENSE-2.0
15+
16+
.. image:: https://robotframework-slack.herokuapp.com/badge.svg
17+
:target: https://robotframework-slack.herokuapp.com
18+
:alt: Slack channel
919

1020

1121
Introduction

src/Selenium2Library/keywords/_element.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ def _parse_attribute_locator(self, attribute_locator):
757757
return (parts[0], parts[2])
758758

759759
def _is_element_present(self, locator, tag=None):
760-
return (self._element_find(locator, True, False, tag=tag) != None)
760+
return (self._element_find(locator, True, False, tag=tag) is not None)
761761

762762
def _page_contains(self, text):
763763
browser = self._current_browser()

src/Selenium2Library/keywords/_formelement.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@ def input_text(self, locator, text):
197197
self._info("Typing text '%s' into text field '%s'" % (text, locator))
198198
self._input_text_into_text_field(locator, text)
199199

200+
def input_text_into_prompt(self, text):
201+
"""Types the given `text` into alert box. """
202+
alert = None
203+
try:
204+
alert = self._current_browser().switch_to_alert()
205+
alert.send_keys(text)
206+
except WebDriverException:
207+
raise RuntimeError('There were no alerts')
208+
200209
def page_should_contain_textfield(self, locator, message='', loglevel='INFO'):
201210
"""Verifies text field identified by `locator` is found from current page.
202211
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*Setting*
2+
Variables variables.py
3+
Resource ../resource.robot
4+
Test Setup Go To Page "javascript/alert_prompt.html"
5+
6+
7+
*Test Cases*
8+
9+
Verify Input Text into Prompt
10+
[Documentation] Typing name into prompt
11+
Click Element css=button
12+
Input Text Into Prompt myname
13+
Get Alert Message
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
5+
<p>Click the button to demonstrate the prompt box.</p>
6+
7+
<button onclick="myFunction()">Try it</button>
8+
9+
<p id="demo"></p>
10+
11+
<script>
12+
function myFunction() {
13+
var person = prompt("Please enter your name", "Harry Potter");
14+
15+
if (person != null) {
16+
document.getElementById("demo").innerHTML =
17+
"Hello " + person + "! How are you today?";
18+
}
19+
}
20+
</script>
21+
22+
</body>
23+
</html>

0 commit comments

Comments
 (0)