Skip to content

Commit c84662a

Browse files
authored
Fixed Get Window Titles when non ascii title (#1257)
* Fixed Get Window Titles when non ascii title * Update to use plural_or_not
1 parent 6cd067d commit c84662a

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

atest/acceptance/windows.robot

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ Get Window Titles
2222
${titles}= Get Window Titles
2323
Should Be Equal ${titles} ${exp_titles}
2424

25+
Get Window Titles With Non ASCII Title
26+
${exp_titles}= Create List Click link to show a popup window äää
27+
Click Link my popup
28+
Wait Until New Window Is Open
29+
${parent} = Select Window Original
30+
Click Element unicode
31+
${titles} = Get Window Titles
32+
Should Be Equal ${titles} ${exp_titles}
33+
[Teardown] Select Window ${parent}
34+
2535
Get Title
2636
${title} = Get Title
2737
Should Be Equal As Strings ${title} Click link to show a popup window

atest/resources/html/javascript/dynamic_content.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<body>
1616
<a href="javascript:return false;" onclick="document.title='Changed'; return false;">change title</a><br/>
1717
<a href="javascript:return false;" onclick="add_content('target', 'added content'); return false;">add content</a><br/>
18+
<a id="unicode" href="javascript:return false;" onclick="document.title='äää'; return false;">title to ääää</a><br/>
1819
<p>
1920
<input type="radio" name="group" value="title"
2021
onclick="document.title='Changed by Button';" />Change Title<br/>

src/SeleniumLibrary/keywords/window.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from SeleniumLibrary.base import keyword, LibraryComponent
2222
from SeleniumLibrary.locators import WindowManager
23+
from SeleniumLibrary.utils import plural_or_not
2324

2425

2526
class WindowKeywords(LibraryComponent):
@@ -219,10 +220,10 @@ def set_window_position(self, x, y):
219220

220221
def _log_list(self, items, what='item'):
221222
msg = [
222-
'Altogether {} {}.'.format(
223-
len(items), what if len(items) == 1 else '{}s'.format(what))
223+
'Altogether %s %s%s.'
224+
% (len(items), what, plural_or_not(items))
224225
]
225226
for index, item in enumerate(items):
226-
msg.append('{}: {}'.format(index + 1, item))
227+
msg.append('%s: %s' % (index + 1, item))
227228
self.info('\n'.join(msg))
228229
return items

0 commit comments

Comments
 (0)