Best Python code snippet using robotframework-appiumlibrary_python
driver.py
Source:driver.py
...135def wait_until_location_contains(expected, timeout=constants.SELENPY_OBJECT_WAIT, message=None):136 waitingKeywords.wait_until_location_contains(expected, timeout, message)137def wait_until_page_contains(text, timeout=constants.SELENPY_OBJECT_WAIT, error=None):138 waitingKeywords.wait_until_page_contains(text, timeout, error)139def wait_until_page_does_not_contain(text, timeout=constants.SELENPY_OBJECT_WAIT,140 error=None):141 waitingKeywords.wait_until_page_does_not_contain(text, timeout, error)142"""143 JAVASCRIPT's FUNCTIONS144"""145def execute_javascript(js_code, *js_args):146 javaScriptKeywords._js_logger('Executing JavaScript', js_code, js_args)147 return javaScriptKeywords.driver.execute_script(js_code, *js_args)148def execute_async_javascript(js_code, *js_args):149 javaScriptKeywords._js_logger('Executing Asynchronous JavaScript', js_code, js_args)...
test.py
Source:test.py
...61 if i >= 1:62 browser_lib.wait_until_page_contains_element("xpath://*[@id='investments-table-object_wrapper']", 20)63 browser_lib.select_from_list_by_label("xpath://*[@id='investments-table-object_length']/label/select", "All")64 browser_lib.wait_until_element_contains("xpath://*[@id='investments-table-object_info']", "Showing 1 to {} of {} entries".format(rows_number, rows_number), 30)65 browser_lib.wait_until_page_does_not_contain("xpath://*[@id='investments-table-object_paginate']/span/a[2]")66 is_visible = browser_lib.is_element_visible("xpath://*[@id='investments-table-object']/tbody/tr[{}]/td[1]/a".format(i+1))67 if is_visible == True:68 browser_lib.click_link("xpath://*[@id='investments-table-object']/tbody/tr[{}]/td[1]/a".format(i+1))69 browser_lib.wait_until_page_contains_element("xpath://*[@id='investment-quick-stats-widget']/div/div[5]/div[1]", 10)70 browser_lib.click_link("xpath://*[@id='business-case-pdf']/a")71 browser_lib.wait_until_element_contains("xpath://*[@id='business-case-pdf']/span", "Generating PDF...", 20)72 browser_lib.wait_until_page_does_not_contain_element("xpath://*[@id='business-case-pdf']/span", 20)73 browser_lib.go_to("https://itdashboard.gov/drupal/summary/005")74 75# Define a main() function that calls the other functions in order:76def main():77 try:78 create_excel_file("/Users/rafaelprado", "xlsx", "Agencies")79 format_excel()80 open_the_website("https://itdashboard.gov/")81 browser_lib.maximize_browser_window()82 browser_lib.click_element_when_visible("id:node-23", False)83 browser_lib.wait_until_element_contains("id:agency-tiles-container", "Department of Agriculture", 5000)84 get_org_amount()85 get_org_title()86 browser_lib.click_element_when_visible("xpath://*[@id='agency-tiles-widget']/div/div[1]/div[1]/div/div/div/div[2]/a")87 browser_lib.set_focus_to_element("xpath://*[@id='block-itdb-custom--5']/div/div/div/div[1]/div/h3")88 browser_lib.wait_until_page_contains_element("xpath://*[@id='investments-table-object_wrapper']", 1000)89 browser_lib.select_from_list_by_label("xpath://*[@id='investments-table-object_length']/label/select", "All")90 browser_lib.wait_until_page_does_not_contain("xpath://*[@id='investments-table-object_paginate']/span/a[2]")91 get_all_table()92 93 finally:94 browser_lib.close_all_browsers()95# Call the main() function, checking that we are running as a stand-alone script:96if __name__ == "__main__":97 main()...
SeleniumLib.py
Source:SeleniumLib.py
...41 @keyword("æ£æ¥ææ¬")42 def wait_until_page_contains(self, text):43 return WaitingKeywords(self).wait_until_page_contains(text=text)44 @keyword("æ£æ¥ææ¬ä¸åå¨")45 def wait_until_page_does_not_contain(self, text):46 return WaitingKeywords(self).wait_until_page_does_not_contain(text=text)47 @keyword("è¾å
¥ææ¬")48 def input_text(self, locator, text):49 locator = self.find_element(locator)50 return FormElementKeywords(self).input_text(locator=locator, text=text)51if __name__ == '__main__':...
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!!