def open_newcreate_submission(self): AllQuotes = WebDriverWait(self.driver, 30, 0.5).until( EC.visibility_of_element_located((By.XPATH, "//div[@class='wizard-sidebar-policies']"))) lis = AllQuotes.find_elements_by_xpath('div') lis[-1].click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") sleep(1)
def click_quote_button(self): WebDriverWait(self.driver, 15, 0.5).until( EC.element_to_be_clickable( (By.XPATH, "//button[@class='nbs-button orange-button next-button']" ))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def click_supplementalinfo_tab(self): js = "var q=document.documentElement.scrollTop=0" self.driver.execute_script(js) gltab = self.driver.find_elements_by_xpath( "//a[@ng-click='switchTab(tab)']") gltab[6].click() if Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']"): Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def click_next_button(self): js = "window.scrollTo(0,document.body.scrollHeight)" self.driver.execute_script(js) WebDriverWait(self.driver, 30, 0.5).until( EC.element_to_be_clickable(( By.XPATH, "//button[@ng-click='submitSelectedProducts(newSubmissionForm)']" ))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def click_next_button(self): WebDriverWait(self.driver, 15, 0.5).until( EC.presence_of_element_located( (By.XPATH, "//button[@type='submit']"))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def input_annualbasis(self, annualbasis): WebDriverWait(self.driver, 15, 0.5).until( EC.presence_of_element_located( (By.XPATH, "//input[@ng-model='premABDisplayValue.value']" ))).send_keys(annualbasis) self.driver.find_element_by_xpath( "//input[@ng-model='premABDisplayValue.value']").send_keys( Keys.TAB) if Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']"): Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def input_searchkeyword(self, keyword): sleep(2) WebDriverWait(self.driver, 15, 0.5).until( EC.presence_of_element_located( (By.XPATH, "//input[@type='search']"))).send_keys(keyword) sleep(1) self.driver.find_element_by_xpath("//input[@type='search']").send_keys( Keys.ENTER) Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def input_classcode(self, classcode): WebDriverWait(self.driver, 15, 0.5).until( EC.presence_of_element_located( (By.XPATH, "//textarea[@name='ClassCode']"))).send_keys(classcode) WebDriverWait(self.driver, 15, 0.5).until( EC.element_to_be_clickable( (By.XPATH, "//span[@ng-click='clickOnSuggestionItem(item)']"))).click() if Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']"): Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def click_makeissuablequote(self): WebDriverWait(self.driver, 15, 0.5).until( EC.element_to_be_clickable(( By.XPATH, "//button[@class='nbs-button orange-button back-button xs-smaller']" ))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") if Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']"): Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def click_view_button(self): js = "var q=document.documentElement.scrollTop=10000" self.driver.execute_script(js) WebDriverWait(self.driver, 20, 0.5).until( EC.visibility_of_element_located( (By.XPATH, "//button[@class='secondary-button desktop-only medium']" ))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") if (Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")): Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def click_startquote(self): WebDriverWait(self.driver, 30, 0.5).until( EC.element_to_be_clickable((By.XPATH, "//div[@class='row align-middle']/div[2]/div/div[2]/button"))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")