def load(self, expectedValues=None, expectedState=None): try: WDW(self.driver, 10).until_not( EC.presence_of_element_located((By.CLASS_NAME, 'overlay'))) self.util = UtilityFunctions(self.driver) self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) self.state = self.load_state() if expectedState and expectedState != self.state: print('Wrong state! Expected ' + str(expectedState) + ', got ' + str(self.state)) return False if self.state == 'fresh': self.newAccountPopUpForm = newAccountPopUpForm.NewAccountPopUpForm( self.driver) # load new popup # todo: need new account to get this state pass else: try: # Only shows up when certain diagnoses are selected on 'Myeloma Diagnosis' self.view_options_button = self.driver.find_element_by_class_name( 'treatment_op_btn') except NoSuchElementException: self.view_options_button = None self.load_add_treatment_button() self.saved_tests = self.driver.find_elements_by_class_name( 'table_container') return self.validate(expectedValues) except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: return False
def load(self): try: # Crap on left self.fitLvlForm = fitLvlForm.FitLvlForm(self.driver) self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) return True except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: return False
def load(self, formInfo=None): try: # Crap on left self.aboutMeForm = aboutMeForm.AboutMeForm(self.driver, formInfo) self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) # self.validate() return True except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: return False
def load(self, expectedValues=None): try: # Crap on left self.currentHealthForm = currentHealthForm.CurrentHealthForm( self.driver, expectedValues) self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) return True except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: return False
def load(self, formInfo=None): try: self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) self.tutorial_button = self.driver.find_element_by_class_name( 'videobtn') self.load_treatment_options() return True except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: return False
def load(self, expectedInfo=None, editMode=False): try: WDW(self.driver, 20).until_not(EC.presence_of_element_located((By.CLASS_NAME, 'overlay'))) self.util = UtilityFunctions(self.driver) self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) # print('0') # Verify consent form is in expected mode (normal or edit) if self.edit_mode() != editMode: print('ConsentForm: Incorrect mode. Expected editMode ' + str(editMode)) return False self.form = self.driver.find_elements_by_tag_name('form')[1] # print('1') try: self.facility_name = self.form.find_elements_by_class_name('font-weight-bold')[1].text except NoSuchElementException: # Facility name is not required field on previous page (for now) self.facility_name = None # print('2') self.load_preferences() # print('3') self.other_input = self.form.find_element_by_id('other_value') # print('4') # Patient Info self.first_name = self.form.find_element_by_id('patient_firstName') self.last_name = self.form.find_element_by_id('patient_lastName') self.rep_first_name = self.form.find_element_by_id('representative_firstName') self.rep_last_name = self.form.find_element_by_id('representative_lastName') self.date_input = self.form.find_element_by_id('dateField') # print('5') # Portal Info self.load_portal_login_info(editMode) # print('6') # Order is not same as displayed on page (float right) self.buttons = self.form.find_elements_by_class_name('green-hvr-bounce-to-top') self.agree_button = self.buttons[0] self.do_not_agree_button = self.buttons[1] self.print_button = self.buttons[2] self.back_button = self.buttons[3] # print('7') return self.validate(expectedInfo) except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: return False
def load(self): WDW(self.driver, 10).until_not( EC.presence_of_element_located((By.CLASS_NAME, 'overlay'))) self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) self.form = self.driver.find_element_by_id('page-content-wrapper') self.continue_button = self.form.find_element_by_tag_name('a') self.load_surveys() # self.validate() return True
def load(self, labInfo=None): try: WDW(self.driver, 20).until_not( EC.presence_of_element_located((By.CLASS_NAME, 'overlay'))) self.util = UtilityFunctions(self.driver) self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) self.form = self.driver.find_element_by_id('page-content-wrapper') buttons = self.form.find_elements_by_tag_name('button') inputs = self.form.find_elements_by_tag_name('input') self.add_new_labs = buttons[0] self.get_my_labs = buttons[1] # Is this here all the time? # Lab Values Chart chart_cont = self.driver.find_element_by_class_name( 'myeloma-labs-custom') self.lab_values_dropdown = chart_cont.find_element_by_tag_name( 'button') # Date range options range_cont = self.driver.find_element_by_class_name('datenfilter') date_buttons = range_cont.find_elements_by_tag_name('button') self.three_month_button = date_buttons[0] self.six_month_button = date_buttons[1] self.year_to_date_button = date_buttons[2] self.one_year_button = date_buttons[3] self.two_year_button = date_buttons[4] self.five_year_button = date_buttons[5] self.ten_year_button = date_buttons[6] self.all_button = date_buttons[7] # Custom date range inputs = range_cont.find_elements_by_tag_name('input') self.from_date_input = inputs[0] self.to_date_input = inputs[1] # Lab Values Table self.load_table() self.continue_button = buttons[10] # self.validate(labInfo) return True except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: return False
def load(self, expectedInfo=None): try: WDW(self.driver, 20).until_not(EC.presence_of_element_located((By.CLASS_NAME, 'overlay'))) self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) self.container = self.driver.find_element_by_id('page-content-wrapper') self.add_facility_button = self.container.find_element_by_class_name('addDiagnoisisButton') # Not in order displayed (float right) self.action_buttons = self.container.find_elements_by_class_name('green-hvr-bounce-to-top') self.facilities = self.load_facilities() return self.validate(expectedInfo) except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: return False
def load(self, expectedTab=None): try: # Crap on left self.menu_tabs = self.driver.find_element_by_class_name('RRT__tabs') self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) self.load_tabs() self.selectedTab = self.selected_tab() if expectedTab and expectedTab != self.selectedTab: print('Full Health Profile: Expected state: "' + str(expectedTab) + '", got state: "' + str(self.selectedTab) + '"') else: if expectedTab == 'my myeloma': self.form = fullHealthMyelomaForm.FullHealthMyelomaForm(self.driver) elif expectedTab == 'demographics': self.form = healthDemoForm.HealthDemoForm(self.driver) elif expectedTab == 'full health history': self.form = healthHistForm.HealthHistForm(self.driver) elif expectedTab == 'family history': self.form = famHistForm.FamHistForm(self.driver) elif expectedTab == 'lifestyle': self.form = healthLifestyleForm.HealthLifestyleForm(self.driver) elif expectedTab == 'quality of life': self.form = healthQualityForm.HealthQualityForm(self.driver) else: self.form = healthSummaryForm.HealthSummaryForm(self.driver) self.loadedData = self.form.sections self.myeloma_tab = self.menu_tabs.find_element_by_id('tab-0') self.demographics_tab = self.menu_tabs.find_element_by_id('tab-1') self.health_history_tab = self.menu_tabs.find_element_by_id('tab-2') self.family_history_tab = self.menu_tabs.find_element_by_id('tab-3') self.lifestyle_tab = self.menu_tabs.find_element_by_id('tab-4') self.quality_tab = self.menu_tabs.find_element_by_id('tab-5') self.summary_tab = self.menu_tabs.find_element_by_id('tab-6') return True except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: pass return False
def load(self, formInfo=None): try: WDW(self.driver, 20).until_not( EC.presence_of_element_located((By.CLASS_NAME, 'overlay'))) self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) form = self.driver.find_elements_by_tag_name('form')[-1] buttons = form.find_elements_by_tag_name('button') self.edit_username_button = buttons[0] self.edit_email_button = buttons[1] self.edit_password_button = buttons[2] # self.validate() return True except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: return False
def load(self, riskInfo=None): self.util = UtilityFunctions(self.driver) try: WDW(self.driver, 20).until_not( EC.presence_of_element_located((By.CLASS_NAME, 'overlay'))) self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) self.load_test_table() # When user has already filled out info # addDiagnosisButtons = self.driver.find_elements_by_class_name('addDiagnoisisButton') # self.add_fish_button = addDiagnosisButtons[0] # self.add_gep_button = addDiagnosisButtons[1] # self.add_ngs_button = addDiagnosisButtons[2] # buttons = self.driver.find_elements_by_tag_name('button') # self.upload_file_button = buttons[2] # cont = self.driver.find_element_by_class_name('genetics-btn') # self.continue_button = cont.find_element_by_tag_name('button') # # self.load_fish_table() # # self.load_gep_table() # # self.load_ngs_table() # # self.load_highRisk_table() # self.container = self.driver.find_element_by_id('page-content-wrapper') # tooltips = self.container.find_elements_by_tag_name('img') # self.fish_tooltip = tooltips[0] # self.gep_tooltip = tooltips[1] # self.ngs_tooltip = tooltips[2] # self.high_risk_tooltip = tooltips[3] # When user hasn't filled anything out # todo return True except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: return False
def load(self, expectedState=None, expectedValues=None): try: self.view_state = self.get_view_state() if expectedState and expectedState != self.view_state: print('Myeloma Diagnosis: Expected state: "' + expectedState + '", got state: "' + self.view_state + '"') else: if self.view_state == 'fresh': self.myelomaDiagnosisFreshForm = myelomaDiagnosisFreshForm.MyelomaDiagnosisFreshForm( self.driver, expectedValues) self.myelomaDiagnosisSavedForm = None else: raw_input('correctly got back state = "saved"') self.myelomaDiagnosisSavedForm = myelomaDiagnosisSavedForm.MyelomaDiagnosisSavedForm( self.driver, expectedValues) self.myelomaDiagnosisFreshForm = None self.menu = menu.Menu(self.driver) self.header = header.AuthHeader(self.driver) return True except (NoSuchElementException, StaleElementReferenceException, IndexError) as e: pass return False