Skip to content

Commit 0eca483

Browse files
authored
Merge pull request #261 from seleniumbase/update-selenium-ide-conversion-tool
Update the selenium ide conversion tool
2 parents ff73a06 + ac56e67 commit 0eca483

File tree

6 files changed

+44
-27
lines changed

6 files changed

+44
-27
lines changed

seleniumbase/config/proxy_list.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
PROXY_LIST = {
2323
"example1": "54.39.97.250:3128", # (Example) - set your own proxy here
24-
"example2": "18.191.175.174:8080", # (Example) - set your own proxy here
2524
"proxy1": None,
2625
"proxy2": None,
2726
"proxy3": None,

seleniumbase/console_scripts/run.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,25 @@ def show_usage():
2727
show_basic_usage()
2828
print('Type "seleniumbase --help" for details on all commands.')
2929
print('Type "seleniumbase help [COMMAND]" for specific command info.')
30-
print('Use "pytest" for running tests.\n')
30+
print('* Use "pytest" for running tests. *\n')
3131

3232

3333
def show_basic_usage():
3434
seleniumbase_logo = logo_helper.get_seleniumbase_logo()
3535
print(seleniumbase_logo)
3636
print("")
3737
print('Usage: "seleniumbase [COMMAND] [PARAMETERS]"')
38-
print(' * (Example: "seleniumbase install chromedriver")')
3938
print("")
4039
print("Commands:")
41-
print(" seleniumbase")
42-
print(" install [DRIVER_NAME]")
43-
print(" mkdir [NEW_TEST_DIRECTORY_NAME]")
44-
print(" convert [PYTHON_WEBDRIVER_UNITTEST_FILE]")
45-
print(" download server")
46-
print(" grid-hub {start|stop|restart} [OPTIONS]")
47-
print(" grid-node {start|stop|restart} --hub=[HUB_IP] [OPTIONS]")
40+
print(' "seleniumbase" +')
41+
print(" install [DRIVER_NAME]")
42+
print(" mkdir [NEW_TEST_DIRECTORY_NAME]")
43+
print(" convert [PYTHON_WEBDRIVER_UNITTEST_FILE]")
44+
print(" download server")
45+
print(" grid-hub {start|stop|restart} [OPTIONS]")
46+
print(" grid-node {start|stop|restart} --hub=[HUB_IP] [OPTIONS]")
47+
print("")
48+
print(' * (Example: "seleniumbase install chromedriver") *')
4849
print("")
4950

5051

seleniumbase/fixtures/base_case.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2549,6 +2549,12 @@ def __click_dropdown_link_text(self, link_text, link_css):
25492549
source = self.get_page_source()
25502550
soup = BeautifulSoup(source, "html.parser")
25512551
drop_down_list = soup.select('[class*=dropdown]')
2552+
for item in soup.select('[class*=HeaderMenu]'):
2553+
drop_down_list.append(item)
2554+
for item in soup.select('[class*=menu-item]'):
2555+
drop_down_list.append(item)
2556+
for item in soup.select('[class*=chevron]'):
2557+
drop_down_list.append(item)
25522558
csstype = link_css.split('[')[1].split('=')[0]
25532559
for item in drop_down_list:
25542560
if link_text in item.text.split('\n') and csstype in item.decode():
@@ -2563,7 +2569,7 @@ def __click_dropdown_link_text(self, link_text, link_css):
25632569
try:
25642570
page_actions.hover_element_and_click(
25652571
self.driver, dropdown, link_text,
2566-
click_by=By.LINK_TEXT, timeout=0.1)
2572+
click_by=By.LINK_TEXT, timeout=0.2)
25672573
return True
25682574
except Exception:
25692575
pass

seleniumbase/fixtures/page_actions.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636

3737
def is_element_present(driver, selector, by=By.CSS_SELECTOR):
3838
"""
39-
Searches for the specified element by the given selector. Returns whether
40-
the element object if the element is present on the page.
39+
Returns whether the specified element selector is present on the page.
4140
@Params
4241
driver - the webdriver object (required)
4342
selector - the locator that is used (required)
@@ -54,8 +53,7 @@ def is_element_present(driver, selector, by=By.CSS_SELECTOR):
5453

5554
def is_element_visible(driver, selector, by=By.CSS_SELECTOR):
5655
"""
57-
Searches for the specified element by the given selector. Returns whether
58-
the element object if the element is present and visible on the page.
56+
Returns whether the specified element selector is visible on the page.
5957
@Params
6058
driver - the webdriver object (required)
6159
selector - the locator that is used (required)
@@ -72,9 +70,7 @@ def is_element_visible(driver, selector, by=By.CSS_SELECTOR):
7270

7371
def is_text_visible(driver, text, selector, by=By.CSS_SELECTOR):
7472
"""
75-
Searches for the specified element by the given selector. Returns whether
76-
the element object if the element is present and visible on the page and
77-
contains the given text.
73+
Returns whether the specified text is visible in the specified selector.
7874
@Params
7975
driver - the webdriver object (required)
8076
text - the text string to search for

seleniumbase/utilities/selenium_ide/convert_ide.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ def main():
154154
selector = '#%s' % data.group(2).replace('#', '\\#')
155155
selector = selector.replace('[', '\\[').replace(']', '\\]')
156156
selector = selector.replace('.', '\\.')
157-
command = '''%sself.click('%s')''' % (whitespace, selector)
157+
raw = ""
158+
if "\\[" in selector or "\\]" in selector or "\\." in selector:
159+
raw = "r"
160+
command = '''%sself.click(%s'%s')''' % (whitespace, raw, selector)
158161
seleniumbase_lines.append(command)
159162
continue
160163

@@ -167,7 +170,10 @@ def main():
167170
selector = '#%s' % data.group(2).replace('#', '\\#')
168171
selector = selector.replace('[', '\\[').replace(']', '\\]')
169172
selector = selector.replace('.', '\\.')
170-
command = '''%sself.submit('%s')''' % (whitespace, selector)
173+
raw = ""
174+
if "\\[" in selector or "\\]" in selector or "\\." in selector:
175+
raw = "r"
176+
command = '''%sself.submit(%s'%s')''' % (whitespace, raw, selector)
171177
seleniumbase_lines.append(command)
172178
continue
173179

@@ -180,9 +186,12 @@ def main():
180186
selector = '#%s' % data.group(2).replace('#', '\\#')
181187
selector = selector.replace('[', '\\[').replace(']', '\\]')
182188
selector = selector.replace('.', '\\.')
189+
raw = ""
190+
if "\\[" in selector or "\\]" in selector or "\\." in selector:
191+
raw = "r"
183192
text = data.group(3)
184-
command = '''%sself.update_text('%s', '%s')''' % (
185-
whitespace, selector, text)
193+
command = '''%sself.update_text(%s'%s', '%s')''' % (
194+
whitespace, raw, selector, text)
186195
seleniumbase_lines.append(command)
187196
continue
188197

@@ -196,9 +205,12 @@ def main():
196205
selector = '#%s' % data.group(2).replace('#', '\\#')
197206
selector = selector.replace('[', '\\[').replace(']', '\\]')
198207
selector = selector.replace('.', '\\.')
208+
raw = ""
209+
if "\\[" in selector or "\\]" in selector or "\\." in selector:
210+
raw = "r"
199211
key = 'Keys.%s' % data.group(3)
200-
command = '''%sself.send_keys('%s', %s)''' % (
201-
whitespace, selector, key)
212+
command = '''%sself.send_keys(%s'%s', %s)''' % (
213+
whitespace, raw, selector, key)
202214
seleniumbase_lines.append(command)
203215
continue
204216

@@ -365,9 +377,12 @@ def main():
365377
selector = '#%s' % data.group(2).replace('#', '\\#')
366378
selector = selector.replace('[', '\\[').replace(']', '\\]')
367379
selector = selector.replace('.', '\\.')
380+
raw = ""
381+
if "\\[" in selector or "\\]" in selector or "\\." in selector:
382+
raw = "r"
368383
visible_text = '%s' % data.group(3)
369-
command = '''%sself.select_option_by_text('%s', '%s')''' % (
370-
whitespace, selector, visible_text)
384+
command = '''%sself.select_option_by_text(%s'%s', '%s')''' % (
385+
whitespace, raw, selector, visible_text)
371386
if command.count('\\"') == command.count('"'):
372387
command = command.replace('\\"', '"')
373388
seleniumbase_lines.append(command)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
setup(
1919
name='seleniumbase',
20-
version='1.17.17',
20+
version='1.17.18',
2121
description='Reliable Browser Automation & Testing Framework',
2222
long_description=long_description,
2323
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)