Best Python code snippet using robotframework-appiumlibrary_python
test_flight_order.py
Source:test_flight_order.py
...29 trip_viewer_page, payment_page, depart_airport, destination_airport, depart_date,30 return_date, first_name, last_name):31 main_page_search_flights_tab.perform_flights_search(depart_airport, destination_airport, depart_date,32 return_date)33 assertions.element_should_be_visible(FlightsTabLocators.FLIGHT_CARDS)34 assertions.element_should_contain_value(FlightsTabLocators.ACTUAL_DEPART_LOCATION, depart_airport)35 assertions.element_should_contain_value(FlightsTabLocators.ACTUAL_DESTINATION_LOCATION,36 destination_airport)37 assertions.element_text_should_contain_formatted_date(38 FlightsTabLocators.ACTUAL_DATES_DESCRIPTION, trip_viewer_page_flights_tab.summary_date_format, depart_date)39 assertions.element_text_should_contain_formatted_date(40 FlightsTabLocators.ACTUAL_DATES_DESCRIPTION, trip_viewer_page_flights_tab.summary_date_format, return_date)41 trip_viewer_page_flights_tab.choose_cheapest_depart_flight()42 trip_viewer_page_flights_tab.choose_cheapest_return_flight()43 trip_viewer_page_flights_tab.choose_light_fare_type()44 trip_viewer_page_flights_tab.input_passengers_data(first_name, last_name)45 trip_viewer_page_seats_tab.choose_later_selection_option()46 trip_viewer_page_bags_tab.choose_one_small_bag()47 trip_viewer_page_extras_tab.continue_order_without_extras()48 trip_viewer_page.close_flight_confirmation_popup()49 trip_viewer_page.open_cart()50 assertions.element_should_be_visible(HeaderLocators.BASKET_ICON)51 assertions.element_should_be_visible(HeaderLocators.BASKET_TOTAL_PRICE)52 assertions.element_should_be_visible(TripPlannerLocators.TRIP_PLANER_SIDEBAR)53 assertions.element_should_contain_value(TripPlannerLocators.DEPART_LOCATION_FIRST_FLIGHT, depart_airport)54 assertions.element_should_contain_value(TripPlannerLocators.DESTINATION_LOCATION_FIRST_FLIGHT,55 destination_airport)56 assertions.element_should_contain_value(TripPlannerLocators.DEPART_LOCATION_SECOND_FLIGHT, depart_airport)57 assertions.element_should_contain_value(TripPlannerLocators.DESTINATION_LOCATION_SECOND_FLIGHT,58 destination_airport)59 assertions.element_text_should_contain_formatted_date(TripPlannerLocators.DEPART_DATE,60 TripViewerPageOverviewTab.flight_search_date_format,61 depart_date)62 assertions.element_text_should_contain_formatted_date(TripPlannerLocators.RETURN_DATE,63 TripViewerPageOverviewTab.flight_search_date_format,64 return_date)65 assertions.element_should_be_clickable(OverviewTabLocators.CHECKOUT_BUTTON)66 assertions.element_text_should_contain_formatted_date(HeaderLocators.BASKET_FIRST_FLIGHT_DATE,67 TripViewerPageHeader.flight_search_date_format,68 depart_date)69 assertions.element_text_should_contain_formatted_date(HeaderLocators.BASKET_SECOND_FLIGHT_DATE,70 TripViewerPageHeader.flight_search_date_format,71 return_date)72 assertions.element_should_contain_value(HeaderLocators.BASKET_DEPART_LOCATION_FIRST_FLIGHT,73 depart_airport)74 assertions.element_should_contain_value(HeaderLocators.BASKET_DESTINATION_LOCATION_FIRST_FLIGHT,75 destination_airport)76 assertions.element_should_contain_value(HeaderLocators.BASKET_DEPART_LOCATION_SECOND_FLIGHT,77 destination_airport)78 assertions.element_should_contain_value(HeaderLocators.BASKET_DESTINATION_LOCATION_SECOND_FLIGHT,79 depart_airport)80 trip_viewer_page.go_checkout()81 payment_page.go_to_passenger_info()82 assertions.element_should_be_visible(PaymentPageLocators.CARD_DETAIL_FORM)83 assertions.element_should_be_visible(PaymentPageLocators.BILLING_ADDRESS_FORM)84 assertions.element_should_be_visible(PaymentPageLocators.PAY_BUTTON)85 assertions.element_should_contain_value(PaymentPageLocators.DEPART_LOCATION_FIRST_FLIGHT, depart_airport)86 assertions.element_should_contain_value(PaymentPageLocators.DESTINATION_LOCATION_FIRST_FLIGHT,87 destination_airport)88 assertions.element_should_contain_value(PaymentPageLocators.DEPART_LOCATION_SECOND_FLIGHT, destination_airport)89 assertions.element_should_contain_value(PaymentPageLocators.DESTINATION_LOCATION_SECOND_FLIGHT, depart_airport)90 assertions.element_text_should_contain_formatted_date(PaymentPageLocators.DEPART_DATE,91 payment_page.flight_search_date_format,92 depart_date)93 assertions.element_text_should_contain_formatted_date(PaymentPageLocators.RETURN_DATE,94 payment_page.flight_search_date_format,95 return_date)96 assertions.element_should_contain_value(PaymentPageLocators.PASSENGER_NAME, first_name)97 assertions.element_should_contain_value(PaymentPageLocators.PASSENGER_NAME, last_name)98 trip_viewer_page.go_to_main()
CustomLib.py
Source:CustomLib.py
...37 self.sl.select_radio_button(name, value)38 self.sl.radio_button_should_be_set_to(name, value)39 @keyword("Input First Name")40 def input_first_name(self, locator, firstname):41 self.sl.element_should_be_visible(locator)42 self.sl.input_text(locator, firstname)43 @keyword("Input Last Name")44 def input_last_name(self, locator, lastname):45 self.sl.element_should_be_visible(locator)46 self.sl.input_text(locator, lastname)47 @keyword("Input Email")48 def input_email(self, locator, email):49 logger.console('Entered Email is : %s' %email)50 self.sl.element_should_be_visible(locator)51 self.sl.input_text(locator, email)52 return email53 @keyword("Input Random Email")54 def input_random_email(self, locator, name):55 randomEmail = self.methodObj.getRandomEmail(name)56 logger.console('Random Generated Email is : %s' %randomEmail)57 self.sl.element_should_be_visible(locator)58 self.sl.input_text(locator, randomEmail)59 return randomEmail60 61 @keyword("Input Random Password")62 def input_random_password(self, locator, name, errorLocator, expectedErrorMsg):63 global randomPassword 64 randomPassword = self.methodObj.getRandomPassword(name)65 logger.console('Random Generated Password is : %s' %randomPassword)66 self.sl.element_should_be_visible(locator)67 self.sl.input_text(locator, randomPassword)68 if(len(randomPassword) < 6):69 self._validate_message(errorLocator, expectedErrorMsg)70 return randomPassword71 @keyword("Input Confirm Password")72 def input_confirm_password(self, locator, errorLocator, expectedErrorMsg):73 confirmPassword = randomPassword74 self.sl.element_should_be_visible(locator)75 self.sl.input_text(locator, confirmPassword)76 if(confirmPassword != randomPassword):77 self._validate_message(errorLocator, expectedErrorMsg)78 @keyword("Click Register Button")79 def click_register_button(self, locator):80 self.sl.page_should_contain_button(locator)81 self.sl.element_should_be_enabled(locator)82 self.sl.click_button(locator)83 @keyword("Register Page Title")84 def register_page_title(self, registerPageTitle):85 self.sl.get_title()86 self.sl.title_should_be(registerPageTitle)87 88 @keyword("Success Register Message")89 def success_register_message(self, locator, expectedMsg):90 self.sl.element_should_be_visible(locator)91 self._validate_message(locator, expectedMsg)92 @keyword("Email Exist Error")93 def email_exist_error(self, locator, expectedMsg):94 self.sl.element_should_be_visible(locator)95 self._validate_message(locator, expectedMsg)96 @keyword("Close Browser Window")97 def close_browser_window(self):98 self.sl.close_browser99class Methods(object):100 randomPart = randint(10,99)101 def __init__(self):102 super().__init__()103 def getRandomEmail(self, name):104 global username105 username = name + str(self.randomPart)106 email = username + '@gmail.com'107 return email108 def getRandomPassword(self, name):...
AppiumRF.py
Source:AppiumRF.py
...29 @wait_visible30 def input_value(self,locator,value):31 super().input_value(self._json_paser(locator),value)32 @wait_visible33 def element_should_be_visible(self, locator, loglevel='INFO'):34 super().element_should_be_visible(self._json_paser(locator),loglevel)35 def element_should_be_visible(self, locator):36 assert (not super().element_should_be_visible(self._json_paser(locator)))37 def element_should_not_contain_text(self, locator, text):38 super().element_should_not_contain_text(self._json_paser(locator), text)39 @wait_visible40 def get_text(self, locator):41 return super().get_text(self._json_paser(locator))42 def clear_and_intput(self, locator, value):43 self.clear_text(locator)44 self.input_value(locator,value)45 def visible_or_not(self,locator):46 try:47 self._element_find(self._json_paser(locator),True,True)48 except:49 return False50 return True...
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!!