Skip to content

Commit 26892f7

Browse files
committed
Update the Selenium IDE converter tool
1 parent b324f71 commit 26892f7

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

seleniumbase/utilities/selenium_ide/convert_ide.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ def main():
151151
r'''\.click\(\)\s*$''', line)
152152
if data:
153153
whitespace = data.group(1)
154-
selector = '#%s' % data.group(2)
154+
selector = '#%s' % data.group(2).replace('#', '\\#')
155155
selector = selector.replace('[', '\\[').replace(']', '\\]')
156+
selector = selector.replace('.', '\\.')
156157
command = '''%sself.click('%s')''' % (whitespace, selector)
157158
seleniumbase_lines.append(command)
158159
continue
@@ -163,8 +164,9 @@ def main():
163164
r'''\.send_keys\(\"([\S\s]+)\"\)\s*$''', line)
164165
if data:
165166
whitespace = data.group(1)
166-
selector = '#%s' % data.group(2)
167+
selector = '#%s' % data.group(2).replace('#', '\\#')
167168
selector = selector.replace('[', '\\[').replace(']', '\\]')
169+
selector = selector.replace('.', '\\.')
168170
text = data.group(3)
169171
command = '''%sself.update_text('%s', '%s')''' % (
170172
whitespace, selector, text)
@@ -178,8 +180,9 @@ def main():
178180
if data:
179181
uses_keys = True
180182
whitespace = data.group(1)
181-
selector = '#%s' % data.group(2)
183+
selector = '#%s' % data.group(2).replace('#', '\\#')
182184
selector = selector.replace('[', '\\[').replace(']', '\\]')
185+
selector = selector.replace('.', '\\.')
183186
key = 'Keys.%s' % data.group(3)
184187
command = '''%sself.send_keys('%s', %s)''' % (
185188
whitespace, selector, key)
@@ -308,7 +311,7 @@ def main():
308311
whitespace = data.group(1)
309312
selector = '%s' % data.group(2)
310313
visible_text = '%s' % data.group(3)
311-
command = '''%sself.pick_select_option_by_text('%s', '%s')''' % (
314+
command = '''%sself.select_option_by_text('%s', '%s')''' % (
312315
whitespace, selector, visible_text)
313316
if command.count('\\"') == command.count('"'):
314317
command = command.replace('\\"', '"')
@@ -322,9 +325,11 @@ def main():
322325
r'''\"([\S\s]+)\"\)\s*$''', line)
323326
if data:
324327
whitespace = data.group(1)
325-
selector = '#%s' % data.group(2)
328+
selector = '#%s' % data.group(2).replace('#', '\\#')
329+
selector = selector.replace('[', '\\[').replace(']', '\\]')
330+
selector = selector.replace('.', '\\.')
326331
visible_text = '%s' % data.group(3)
327-
command = '''%sself.pick_select_option_by_text('%s', '%s')''' % (
332+
command = '''%sself.select_option_by_text('%s', '%s')''' % (
328333
whitespace, selector, visible_text)
329334
if command.count('\\"') == command.count('"'):
330335
command = command.replace('\\"', '"')
@@ -340,7 +345,7 @@ def main():
340345
whitespace = data.group(1)
341346
selector = '%s' % data.group(2)
342347
visible_text = '%s' % data.group(3)
343-
command = '''%sself.pick_select_option_by_text("%s", '%s')''' % (
348+
command = '''%sself.select_option_by_text("%s", '%s')''' % (
344349
whitespace, selector, visible_text)
345350
if command.count('\\"') == command.count('"'):
346351
command = command.replace('\\"', '"')
@@ -356,7 +361,7 @@ def main():
356361
whitespace = data.group(1)
357362
selector = '[name="%s"]' % data.group(2)
358363
visible_text = '%s' % data.group(3)
359-
command = '''%sself.pick_select_option_by_text('%s', '%s')''' % (
364+
command = '''%sself.select_option_by_text('%s', '%s')''' % (
360365
whitespace, selector, visible_text)
361366
if command.count('\\"') == command.count('"'):
362367
command = command.replace('\\"', '"')

0 commit comments

Comments
 (0)