How to use __jq_confirm_dialog method in SeleniumBase

Best Python code snippet using SeleniumBase

master_qa.py

Source:master_qa.py Github

copy

Full Screen

...88 f.startswith("automation_failure")) or (89 f == self.BAD_PAGE_LOG)]90 for f in filelist:91 os.remove("%s/%s" % (file_path, f))92 def __jq_confirm_dialog(self, question):93 count = self.manual_check_count + 194 title = self.DEFAULT_VALIDATION_TITLE95 title_content = ('<center><font color="#7700bb">%s #%s:'96 '</font></center><hr><font color="#0066ff">%s</font>'97 '' % (title, count, question))98 title_content = js_utils.escape_quotes_if_needed(title_content)99 jqcd = ("""jconfirm({100 boxWidth: '32.5%%',101 useBootstrap: false,102 containerFluid: false,103 animationBounce: 1,104 type: 'default',105 theme: 'bootstrap',106 typeAnimated: true,107 animation: 'scale',108 draggable: true,109 dragWindowGap: 1,110 container: 'body',111 title: '%s',112 content: '',113 buttons: {114 fail_button: {115 btnClass: 'btn-red',116 text: 'NO / FAIL',117 action: function(){118 $jqc_status = "Failure!"119 }120 },121 pass_button: {122 btnClass: 'btn-green',123 text: 'YES / PASS',124 action: function(){125 $jqc_status = "Success!"126 }127 }128 }129 });""" % title_content)130 self.execute_script(jqcd)131 def __manual_page_check(self, *args):132 if not args:133 instructions = self.DEFAULT_VALIDATION_MESSAGE # self.verify()134 else:135 instructions = str(args[0])136 if len(args) > 1:137 pass138 question = "Approve?" # self.verify("")139 if instructions and "?" not in instructions:140 question = instructions + " <> Approve?"141 elif instructions and "?" in instructions:142 question = instructions143 wait_time_before_verify = self.WAIT_TIME_BEFORE_VERIFY144 if self.verify_delay:145 wait_time_before_verify = float(self.verify_delay)146 # Allow a moment to see the full page before the dialog box pops up147 time.sleep(wait_time_before_verify)148 use_jqc = False149 self.wait_for_ready_state_complete()150 if js_utils.is_jquery_confirm_activated(self.driver):151 use_jqc = True152 else:153 js_utils.activate_jquery_confirm(self.driver)154 get_jqc = None155 try:156 get_jqc = self.execute_script("return jconfirm")157 get_jqc = get_jqc["instances"]158 use_jqc = True159 except Exception:160 use_jqc = False161 if use_jqc:162 # Use the jquery_confirm library for manual page checks163 self.__jq_confirm_dialog(question)164 time.sleep(0.02)165 waiting_for_response = True166 while waiting_for_response:167 time.sleep(0.05)168 jqc_open = self.execute_script(169 "return jconfirm.instances.length")170 if str(jqc_open) == "0":171 break172 time.sleep(0.1)173 status = None174 try:175 status = self.execute_script("return $jqc_status")176 except Exception:177 status = "Failure!"...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeleniumBase automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful