Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def jq_confirm_dialog(self, question):
count = self.manual_check_count + 1
title_content = ('<center><font color="#7700bb">Manual Check #%s:'
'</font></center><hr><font color="#0066ff">%s</font>'
'' % (count, question))
title_content = js_utils.escape_quotes_if_needed(title_content)
jqcd = ("""jconfirm({
boxWidth: '32.5%%',
useBootstrap: false,
containerFluid: false,
animationBounce: 1,
type: 'default',
theme: 'bootstrap',
typeAnimated: true,
animation: 'scale',
draggable: true,
dragWindowGap: 1,
container: 'body',
title: '%s',
content: '',
buttons: {
fail_button: {
seleniumbase_lines.append(lines[line_num])
# Remove duplicate functionality (wait_for_link_text)
lines = seleniumbase_lines
seleniumbase_lines = []
num_lines = len(lines)
for line_num in range(len(lines)):
data = re.match(
r'''^\s*self.wait_for_link_text'''
r'''\((["|'])([\S\s]+)(["|'])\)'''
r'''\s*$''', lines[line_num])
if data:
# quote_type = data.group(1)
link_text = data.group(2)
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*$''')
data2 = re.match(regex_string, lines[line_num + 1])
if data2:
continue
seleniumbase_lines.append(lines[line_num])
seleniumbase_code = ""
if has_unicode:
seleniumbase_code = "# -*- coding: utf-8 -*-\n"
if uses_keys:
seleniumbase_code += (
"from selenium.webdriver.common.keys import Keys\n")
if uses_select:
seleniumbase_code += (
'''};\n'''
'''function injectStyle(css) {'''
'''var head = document.getElementsByTagName("head")[0];'''
'''var style = document.createElement("style");'''
'''style.type = "text/css";'''
'''style.appendChild(document.createTextNode(css));'''
'''head.appendChild(style);'''
'''};\n''' % (url, url))
if tour_type == "bootstrap":
jquery_js = constants.JQuery.MIN_JS
bootstrap_tour_css = constants.BootstrapTour.MIN_CSS
bootstrap_tour_js = constants.BootstrapTour.MIN_JS
backdrop_style = style_sheet.bt_backdrop_style
backdrop_style = backdrop_style.replace('\n', '')
backdrop_style = js_utils.escape_quotes_if_needed(backdrop_style)
instructions += 'injectJS("%s");\n' % jquery_js
instructions += '\n'
instructions += 'function loadResources() { '
instructions += 'if ( typeof jQuery !== "undefined" ) {\n'
instructions += 'injectCSS("%s");\n' % bootstrap_tour_css
instructions += 'injectStyle("%s");\n' % backdrop_style
instructions += 'injectJS("%s");' % bootstrap_tour_js
instructions += '} else { window.setTimeout("loadResources();",100); '
instructions += '} }\n'
instructions += 'loadResources()'
elif tour_type == "hopscotch":
hopscotch_css = constants.Hopscotch.MIN_CSS
hopscotch_js = constants.Hopscotch.MIN_JS
backdrop_style = style_sheet.hops_backdrop_style
backdrop_style = backdrop_style.replace('\n', '')
uses_select = True
# Remove duplicate functionality (wait_for_element)
lines = seleniumbase_lines
seleniumbase_lines = []
num_lines = len(lines)
for line_num in range(len(lines)):
data = re.match(
r'''^\s*self.wait_for_element'''
r'''\((["|'])([\S\s]+)(["|'])\)'''
r'''\s*$''', lines[line_num])
if data:
# quote_type = data.group(1)
selector = data.group(2)
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*$''')
data2 = re.match(regex_string, lines[line_num + 1])
if data2:
continue
regex_string = (r'''^\s*self.update_text\(["|']'''
'' + selector + ''
'' + r'''["|'], [\S\s]+\)\s*$''')
data2 = re.match(regex_string, lines[line_num + 1])
if data2:
continue
seleniumbase_lines.append(lines[line_num])
# Remove duplicate functionality (wait_for_link_text)
lines = seleniumbase_lines
instructions += 'injectJS("%s");' % intro_js
elif tour_type == "shepherd":
jquery_js = constants.JQuery.MIN_JS
shepherd_js = constants.Shepherd.MIN_JS
sh_theme_arrows_css = constants.Shepherd.THEME_ARROWS_CSS
sh_theme_arrows_fix_css = constants.Shepherd.THEME_ARR_FIX_CSS
sh_theme_default_css = constants.Shepherd.THEME_DEFAULT_CSS
sh_theme_dark_css = constants.Shepherd.THEME_DARK_CSS
sh_theme_sq_css = constants.Shepherd.THEME_SQ_CSS
sh_theme_sq_dark_css = constants.Shepherd.THEME_SQ_DK_CSS
tether_js = constants.Tether.MIN_JS
spinner_css = constants.Messenger.SPINNER_CSS
backdrop_style = style_sheet.sh_backdrop_style
backdrop_style = backdrop_style.replace('\n', '')
backdrop_style = js_utils.escape_quotes_if_needed(backdrop_style)
instructions += 'injectCSS("%s");\n' % spinner_css
instructions += 'injectJS("%s");\n' % jquery_js
instructions += 'injectJS("%s");\n' % tether_js
instructions += '\n'
instructions += 'function loadResources() { '
instructions += 'if ( typeof jQuery !== "undefined" ) {\n'
instructions += 'injectCSS("%s");' % sh_theme_arrows_css
instructions += 'injectCSS("%s");' % sh_theme_arrows_fix_css
instructions += 'injectCSS("%s");' % sh_theme_default_css
instructions += 'injectCSS("%s");' % sh_theme_dark_css
instructions += 'injectCSS("%s");' % sh_theme_sq_css
instructions += 'injectCSS("%s");\n' % sh_theme_sq_dark_css
instructions += 'injectStyle("%s");\n' % backdrop_style
instructions += 'injectJS("%s");\n' % shepherd_js
instructions += '} else { window.setTimeout("loadResources();",100); '
instructions += '} }\n'
def jq_confirm_dialog(self, question):
count = self.manual_check_count + 1
title_content = ('<center><font color="#7700bb">Manual Check #%s:'
'</font></center><hr><font color="#0066ff">%s</font>'
'' % (count, question))
title_content = js_utils.escape_quotes_if_needed(title_content)
jqcd = ("""jconfirm({
boxWidth: '32.5%%',
useBootstrap: false,
containerFluid: false,
animationBounce: 1,
type: 'default',
theme: 'bootstrap',
typeAnimated: true,
animation: 'scale',
draggable: true,
dragWindowGap: 1,
container: 'body',
title: '%s',
content: '',
buttons: {
fail_button: {