Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ parameterized==0.6.1
beautifulsoup4>=4.6.0
pyotp>=2.2.6
boto>=2.49.0
flake8==3.5.0
flake8==3.6.0
PyVirtualDisplay==0.2.1
-e .
16 changes: 8 additions & 8 deletions seleniumbase/common/encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,18 @@ def decrypt(string):
rem4 = (len(string) + ord_string_sum(string)) % 2
if len(string) % 2 != 0:
if rem3 == 1:
string = (chr(ord(string[-1]) - 5 - rem1) + string +
chr(ord(string[-1]) - 13 - rem1))
string = (chr(ord(string[-1]) - 5 - rem1) + string + ''
'' + chr(ord(string[-1]) - 13 - rem1))
else:
string = (chr(ord(string[-1]) - 11 - rem1) + string +
chr(ord(string[-1]) - 23 - rem1))
string = (chr(ord(string[-1]) - 11 - rem1) + string + ''
'' + chr(ord(string[-1]) - 23 - rem1))
elif len(string) > 1:
if rem4 == 1:
string = (chr(ord(string[0]) - 19 + rem2) + string +
chr(ord(string[0]) - 7 - rem2))
string = (chr(ord(string[0]) - 19 + rem2) + string + ''
'' + chr(ord(string[0]) - 7 - rem2))
else:
string = (chr(ord(string[0]) - 26 + rem2) + string +
chr(ord(string[0]) - 12 - rem2))
string = (chr(ord(string[0]) - 26 + rem2) + string + ''
'' + chr(ord(string[0]) - 12 - rem2))
rem5 = (len(string) + ord_string_sum(string)) % 23
string = rotate(string, rem5)
result = str_xor(shuffle_string(string)[::-1], xor_key)
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/core/s3_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def upload_index_file(self, test_address, timestamp):
index = self.get_key(file_name)
index_str = []
for completed_file in already_uploaded_files:
index_str.append("<a href='" + self.bucket_url +
index_str.append("<a href='" + self.bucket_url + ""
"%s'>%s</a>" % (completed_file, completed_file))
index.set_contents_from_string(
"<br>".join(index_str),
Expand Down
4 changes: 2 additions & 2 deletions seleniumbase/core/tour_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ def play_shepherd_tour(driver, tour_steps, msg_dur, name=None, interval=0):
stop_ms = start_ms + (interval * 1000.0)
now_ms = time.time() * 1000.0
if now_ms >= stop_ms:
if ((element == latest_element) and
(shep_text == latest_text)):
if ((element == latest_element) and (
shep_text == latest_text)):
driver.execute_script("Shepherd.activeTour.next()")
try:
latest_element = driver.execute_script(
Expand Down
6 changes: 3 additions & 3 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -2793,9 +2793,9 @@ def tearDown(self):
test_logpath = self.log_path + "/" + test_id
if not os.path.exists(test_logpath):
os.makedirs(test_logpath)
if ((not self.with_screen_shots) and
(not self.with_basic_test_info) and
(not self.with_page_source)):
if ((not self.with_screen_shots) and (
not self.with_basic_test_info) and (
not self.with_page_source)):
# Log everything if nothing specified (if testing_base)
log_helper.log_screenshot(test_logpath, self.driver)
log_helper.log_test_failure_data(
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/fixtures/email_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def fixup(text):
except KeyError:
pass
return text # leave as is
return re.sub("&#?\w+;", fixup, html)
return re.sub(r"&#?\w+;", fixup, html)

def decode_quoted_printable(self, html):
"""
Expand Down
4 changes: 2 additions & 2 deletions seleniumbase/fixtures/js_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ def activate_jquery(driver):


def are_quotes_escaped(string):
if (string.count("\\'") != string.count("'") or
string.count('\\"') != string.count('"')):
if (string.count("\\'") != string.count("'") or (
string.count('\\"') != string.count('"'))):
return True
return False

Expand Down
8 changes: 3 additions & 5 deletions seleniumbase/fixtures/page_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ def is_xpath_selector(selector):
"""
A basic method to determine if a selector is an xpath selector.
"""
if (selector.startswith('/') or
selector.startswith('./') or
selector.startswith('(')):
if (selector.startswith('/') or selector.startswith('./') or (
selector.startswith('('))):
return True
return False

Expand All @@ -35,8 +34,7 @@ def is_link_text_selector(selector):
"""
A basic method to determine if a selector is a link text selector.
"""
if (selector.startswith('link=') or
selector.startswith('link_text=')):
if (selector.startswith('link=') or selector.startswith('link_text=')):
return True
return False

Expand Down
44 changes: 22 additions & 22 deletions seleniumbase/fixtures/xpath_to_css.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
import re

_sub_regexes = {
"tag": "([a-zA-Z][a-zA-Z0-9]{0,10}|\*)",
"attribute": "[.a-zA-Z_:][-\w:.]*(\(\))?)",
"value": "\s*[\w/:][-/\w\s,:;.]*"
"tag": r"([a-zA-Z][a-zA-Z0-9]{0,10}|\*)",
"attribute": r"[.a-zA-Z_:][-\w:.]*(\(\))?)",
"value": r"\s*[\w/:][-/\w\s,:;.]*"
}

_validation_re = (
"(?P<node>"
"("
"^id\([\"\']?(?P<idvalue>%(value)s)[\"\']?\)"
"|"
"(?P<nav>//?)(?P<tag>%(tag)s)"
"(\[("
"(?P<matched>(?P<mattr>@?%(attribute)s=[\"\']"
"(?P<mvalue>%(value)s))[\"\']"
"|"
"(?P<contained>contains\((?P<cattr>@?%(attribute)s,\s*[\"\']"
"(?P<cvalue>%(value)s)[\"\']\))"
")\])?"
"(\[(?P<nth>\d)\])?"
")"
")" % _sub_regexes
r"(?P<node>"
r"("
r"^id\([\"\']?(?P<idvalue>%(value)s)[\"\']?\)"
r"|"
r"(?P<nav>//?)(?P<tag>%(tag)s)"
r"(\[("
r"(?P<matched>(?P<mattr>@?%(attribute)s=[\"\']"
r"(?P<mvalue>%(value)s))[\"\']"
r"|"
r"(?P<contained>contains\((?P<cattr>@?%(attribute)s,\s*[\"\']"
r"(?P<cvalue>%(value)s)[\"\']\))"
r")\])?"
r"(\[(?P<nth>\d)\])?"
r")"
r")" % _sub_regexes
)

prog = re.compile(_validation_re)
Expand Down Expand Up @@ -136,11 +136,11 @@ def convert_xpath_to_css(xpath):

css = _get_raw_css_from_xpath(xpath)

attribute_defs = re.findall('(\[\w+\=\S+\])', css)
attribute_defs = re.findall(r'(\[\w+\=\S+\])', css)
for attr_def in attribute_defs:
if (attr_def.count('[') == 1 and attr_def.count(']') == 1 and
attr_def.count('=') == 1 and attr_def.count('"') == 0 and
attr_def.count("'") == 0) and attr_def.count(' ') == 0:
if (attr_def.count('[') == 1 and attr_def.count(']') == 1 and (
attr_def.count('=') == 1) and attr_def.count('"') == 0 and (
attr_def.count("'") == 0)) and attr_def.count(' ') == 0:
# Now safe to manipulate
q1 = attr_def.find('=') + 1
q2 = attr_def.find(']')
Expand Down
12 changes: 6 additions & 6 deletions seleniumbase/plugins/base_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ def __log_all_options_if_none_specified(self, test):
specified (basic_test_info, screen_shots, page_source), then save them
all by default. Otherwise, save only selected ones from their plugins.
"""
if ((not self.options.enable_plugin_basic_test_info) and
(not self.options.enable_plugin_screen_shots) and
(not self.options.enable_plugin_page_source)):
if ((not self.options.enable_plugin_basic_test_info) and (
not self.options.enable_plugin_screen_shots) and (
not self.options.enable_plugin_page_source)):
test_logpath = self.options.log_path + "/" + test.id()
log_helper.log_screenshot(test_logpath, test.driver)
log_helper.log_test_failure_data(
Expand Down Expand Up @@ -165,9 +165,9 @@ def addError(self, test, err, capt=None):
error states, we want to make sure that they don't show up in
the nose output as errors.
"""
if (err[0] == errors.BlockedTest or
err[0] == errors.SkipTest or
err[0] == errors.DeprecatedTest):
if (err[0] == errors.BlockedTest or (
err[0] == errors.SkipTest) or (
err[0] == errors.DeprecatedTest)):
print(err[1].__str__().split('''-------------------- >> '''
'''begin captured logging'''
''' << --------------------''', 1)[0])
Expand Down
14 changes: 7 additions & 7 deletions seleniumbase/utilities/selenium_ide/convert_ide.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,14 @@ def main():
selector = re.escape(selector)
selector = js_utils.escape_quotes_if_needed(selector)
if int(line_num) < num_lines - 1:
regex_string = (r'''^\s*self.click\(["|']''' +
selector + r'''["|']\)\s*$''')
regex_string = (r'''^\s*self.click\(["|']'''
'' + selector + r'''["|']\)\s*$''')
data2 = re.match(regex_string, lines[line_num + 1])
if data2:
continue
regex_string = (r'''^\s*self.update_text\(["|']''' +
selector +
r'''["|'], [\S\s]+\)\s*$''')
regex_string = (r'''^\s*self.update_text\(["|']'''
'' + selector + ''
'' + r'''["|'], [\S\s]+\)\s*$''')
data2 = re.match(regex_string, lines[line_num + 1])
if data2:
continue
Expand All @@ -617,8 +617,8 @@ def main():
link_text = re.escape(link_text)
link_text = js_utils.escape_quotes_if_needed(link_text)
if int(line_num) < num_lines - 2:
regex_string = (r'''^\s*self.click\(["|']link=''' +
link_text + r'''["|']\)\s*$''')
regex_string = (r'''^\s*self.click\(["|']link='''
'' + link_text + r'''["|']\)\s*$''')
data2 = re.match(regex_string, lines[line_num + 1])
if data2:
continue
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

setup(
name='seleniumbase',
version='1.17.1',
version='1.17.2',
description='All-in-One Test Automation Framework',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down Expand Up @@ -70,7 +70,7 @@
'beautifulsoup4>=4.6.0', # Keep at >=4.6.0 while using bs4
'pyotp>=2.2.6',
'boto>=2.49.0',
'flake8==3.5.0',
'flake8==3.6.0',
'PyVirtualDisplay==0.2.1',
],
packages=[
Expand Down