Skip to content

Commit 0fc0373

Browse files
committed
Merge pull request #380 from zephraph/choose-file-assert
Fix for #372
2 parents 1d16762 + b735f28 commit 0fc0373

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

CHANGES.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Release Notes
2020
known browser and python version noncritical. Also added a noncritical case to the
2121
travis config for situations where testing is failing on travis for an unknown reason.
2222
- 'Capture Screenshot' now attempts to create its containing directory if the directory
23-
specified in the filename does not exist.
23+
specified in the filename does not exist.
24+
- 'Choose File' now fails if the file doesn't exist
2425
[zephraph]
2526

2627
- Added 'Get Window Position' and 'Set Window Position' keywords matching the

src/Selenium2Library/keywords/_formelement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def choose_file(self, locator, file_path):
175175
| Choose File | my_upload_field | /home/user/files/trades.csv |
176176
"""
177177
if not os.path.isfile(file_path):
178-
self._info("File '%s' does not exist on the local file system"
178+
raise AssertionError("File '%s' does not exist on the local file system"
179179
% file_path)
180180
self._element_find(locator, True, True).send_keys(file_path)
181181

test/acceptance/keywords/forms_and_buttons.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ Click button created with <button> by tag content
5353

5454
Choose File
5555
[Setup] Navigate To File Upload Form And Create Temp File To Upload
56-
Choose File file_to_upload ${TEMPDIR}${/}temp.txt
56+
Choose File file_to_upload ${CURDIR}${/}temp.txt
5757
${dep_browser}= Set Variable If '${BROWSER}'.lower() == 'ff' or '${BROWSER}'.lower() == 'firefox' temp.txt C:\\fakepath\\temp.txt #Needs to be checked in Windows and OS X
5858
Textfield Value Should Be name= file_to_upload ${dep_browser}
59-
[Teardown] Remove File ${TEMPDIR}${/}temp.txt
59+
[Teardown] Remove File ${CURDIR}${/}temp.txt
6060

6161
Click Image With Submit Type Images
6262
[Setup] Go To Page "forms/form_with_image_submit.html"
@@ -73,4 +73,3 @@ Navigate To File Upload Form And Create Temp File To Upload
7373
Cannot Be Executed in IE
7474
Go To Page "forms/file_upload_form.html"
7575
Touch ${CURDIR}${/}temp.txt
76-

0 commit comments

Comments
 (0)