Best Python code snippet using robotframework-appiumlibrary_python
AdvancedMappingPageObject.py
Source:AdvancedMappingPageObject.py
...18 def create_new_field_mapping(self,src_fld,tgt_fld):19 """Click on Create New Field Mapping button on the page 20 select 'src_fld' arg in Source Field Label box21 'tgt_fld' arg in Target Field Label box"""22 self.selenium.wait_until_page_contains("Field Mappings", timeout=60)23 btns=npsp_lex_locators['adv_mappings']['button']24 self.selenium.scroll_element_into_view(btns)25 self.selenium.click_button(btns)26 mdl_open=npsp_lex_locators['adv_mappings']["modal_open"]27 self.selenium.wait_until_page_contains_element(mdl_open, timeout=15, 28 error="New Field Mapping Modal did not open in 15 seconds")29 src_loc=npsp_lex_locators['adv_mappings']['field_mapping'].format("sourceFieldLabel")30 self.selenium.click_element(src_loc)31 dd=npsp_lex_locators['adv_mappings']['combobox']32 self.selenium.wait_until_page_contains_element(dd, error="Source field dropdown did not open")33 src_ele=npsp_lex_locators['span'].format(src_fld)34 element = self.selenium.driver.find_element_by_xpath(src_ele)35 self.selenium.driver.execute_script('arguments[0].click()', element) 36 target=npsp_lex_locators['adv_mappings']['field_mapping'].format("targetFieldLabel")37 self.selenium.click_element(target)38 self.selenium.wait_until_page_contains_element(dd, error="Target field dropdown did not open")39 self.selenium.click_element(npsp_lex_locators['span'].format(tgt_fld))40 self.selenium.click_button("Save")41 self.selenium.wait_until_page_does_not_contain_element(mdl_open, timeout=15, 42 error="New Field Mapping Modal did not close in 15 seconds")43 self.selenium.wait_until_page_contains("Success", timeout=180)44 45 @capture_screenshot_on_error46 def view_field_mappings_of_the_object(self,obj):47 """Click the dropdwon for obj and select View Field Mappings and verify that field mappings page is open"""48 self.selenium.wait_until_page_contains("Object Groups", timeout=60)49 locator=npsp_lex_locators['adv_mappings']['dropdown'].format(obj)50 self.selenium.scroll_element_into_view(locator)51 self.selenium.click_button(locator)52 self.selenium.wait_until_page_contains("View Field Mappings", timeout=60)53 self.selenium.click_link("View Field Mappings")54 self.selenium.wait_until_page_contains("Field Mappings", timeout=60)55 56 @capture_screenshot_on_error 57 def edit_field_mappings(self,fld_name,tgt_field):58 """Click the dropdown for fieldname and select edit and wait for model is open. 59 Once modal is open click on Target field to open a dropdown and select 'target_field' from available options"""60 locator=npsp_lex_locators['adv_mappings']['dropdown'].format(fld_name)61 self.selenium.scroll_element_into_view(locator)62 self.selenium.click_button(locator)63 self.selenium.wait_until_page_contains("Edit", timeout=60)64 self.selenium.click_link("Edit")65 mdl_open=npsp_lex_locators['adv_mappings']["modal_open"]66 self.selenium.wait_until_page_contains_element(mdl_open, timeout=15, 67 error="Edit Field Mapping Modal did not open in 15 seconds")68 target=npsp_lex_locators['adv_mappings']['field_mapping'].format("targetFieldLabel")69 self.selenium.click_element(target)70 dd=npsp_lex_locators['adv_mappings']['combobox']71 self.selenium.wait_until_page_contains_element(dd, error="Target field dropdown did not open")72 self.selenium.click_element(npsp_lex_locators['span'].format(tgt_field))73 self.selenium.click_button("Save")74 self.selenium.wait_until_page_does_not_contain_element(mdl_open, timeout=15, 75 error="Edit Field Mapping Modal did not close in 15 seconds")76 self.selenium.wait_until_page_contains("Success", timeout=180)77 78 @capture_screenshot_on_error 79 def delete_field_mapping(self,fld_name):80 """Click the dropdown for fld_name and select Delete and wait for field mapping to not present on the page."""81 locator=npsp_lex_locators['adv_mappings']['dropdown'].format(fld_name) 82 self.selenium.scroll_element_into_view(locator)83 self.selenium.click_button(locator)84 self.selenium.wait_until_page_contains("Delete", timeout=60)85 self.selenium.click_link("Delete")86 self.selenium.wait_until_page_contains("Success", timeout=180)87 self.selenium.wait_until_page_does_not_contain(fld_name, timeout=60)88 89 @capture_screenshot_on_error 90 def delete_mapping_if_mapping_exists(self,fld_label):91 """Checks if mapping with fld_label exists and if exists deletes the mapping. If not then does nothing"""92 locator=npsp_lex_locators['adv_mappings']['field-label'].format(fld_label)93 if self.npsp.check_if_element_exists(locator):...
HealthCarePage.py
Source:HealthCarePage.py
...15 raise Exception(message)16 return True17 def answer_questions(self, *options):18 for a in options:19 self.se2lib.wait_until_page_contains(a)20 self.se2lib.click_element('xpath=//*[contains(text(),"'+a+'")]')21 self.se2lib.wait_until_page_contains(self.locator.Weiter)22 self.se2lib.click_link(self.locator.Weiter)23 def check_results(self, *options):24 self.se2lib.wait_until_page_contains('Ihre Filter')25 for a in options:...
EldersCarePage.py
Source:EldersCarePage.py
...13 "Weiter": "Weiter"14 }15 def answer_questions(self, *options):16 for a in options:17 self.se2lib.wait_until_page_contains(a)18 self.se2lib.click_element('xpath=//*[contains(text(),"' + a + '")]')19 self.se2lib.wait_until_page_contains(self.locator.Weiter)20 self.se2lib.click_link(self.locator.Weiter)21 def check_results(self, *options):22 self.se2lib.wait_until_page_contains('Ihre Filter')23 for a in options:...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!