How to use wait_until_page_contains_element method in robotframework-appiumlibrary

Best Python code snippet using robotframework-appiumlibrary_python

pages.py

Source:pages.py Github

copy

Full Screen

...11 self._sel.go_to(self._device.get_device_address())12 self._seleniumext.wait_until_page_contains_any_element(['name:ModeLoginHome', 'css:#navigationSidebar a[href="InfoDeviceInfo.html"]'], timeout)13 def go_to_login_page(self, timeout='20s'): # was 5s14 self._sel.go_to(self._device.get_device_address('/ModeLoginHome.html'))15 self._sel.wait_until_page_contains_element('name:ModeLoginHome', timeout, error='Login page not found')16 def go_to_upgrade_page(self, timeout=None):17 self._sel.go_to(self._device.get_device_address('/Fallback.html'))18 self._sel.wait_until_page_contains_element('css:form[action="fileupload.html"]', timeout, error='Upgrade page not found')19 def go_to_fallback_maintenance_page(self, timeout=None):20 self._sel.go_to(self._device.get_device_address('/Fallback.html?page=Maintenance'))21 self._sel.wait_until_page_contains_element('css:form[action="fwupload_zeroize_device.html"]', timeout, error='Fallback maintenance page not found')22 def go_to_ac_operational_values_page(self, timeout=None):23 self._sel.go_to(self._device.get_device_address('/ViewAcOpVals.html'))24 self._sel.wait_until_page_contains_element('css:form[action="ViewAcOpVals.html"]', timeout, error='AC operational values page not found')25 def go_to_device_info_page(self, timeout=None):26 self._sel.go_to(self._device.get_device_address('/InfoDeviceInfo.html'))27 self._sel.wait_until_page_contains_element('css:form[action="InfoDeviceInfo.html"]', timeout, error='Device information page not found')28 def go_to_info_operational_log_page(self, timeout=None):29 self._sel.go_to(self._device.get_device_address('/InfoOpLog.html'))30 self._sel.wait_until_page_contains_element('css:form[action="InfoOpLog.html"]', timeout, error='Operational log page not found')31 def go_to_firmware_upload_page(self, timeout=None):32 self._sel.go_to(self._device.get_device_address('/MaintFwUpload.html'))33 self._sel.wait_until_page_contains_element('css:form[action="MaintFwUpload.html"]', timeout, error='Firmware upload page not found')34 def go_to_format_sd_card_page(self, timeout=None):35 self._sel.go_to(self._device.get_device_address('/MaintFormatSDCard.html'))36 self._sel.wait_until_page_contains_element('css:form[action="MaintFormatSDCard.html"]', timeout, error='Format SD card page not found')37 def go_to_reset_counters_page(self, timeout=None):38 self._sel.go_to(self._device.get_device_address('/MaintCounters.html'))39 self._sel.wait_until_page_contains_element('css:form[action="MaintCounters.html"]', timeout, error='Reset counter page not found')40 def go_to_set_datetime_page(self, timeout=None):41 self._sel.go_to(self._device.get_device_address('/MaintDateTime.html'))42 self._sel.wait_until_page_contains_element('css:form[action="MaintDateTime.html"]', timeout, error='Set datetime page not found')43 def go_to_reset_peak_values_page(self, timeout=None):44 self._sel.go_to(self._device.get_device_address('/MaintPeakValues.html'))45 self._sel.wait_until_page_contains_element('css:form[action="MaintPeakValues.html"]', timeout, error='Reset min and max values page not found')46 def go_to_delete_load_profile_buffer_page(self, timeout=None):47 self._sel.go_to(self._device.get_device_address('/MaintLoadProfile.html'))48 self._sel.wait_until_page_contains_element('css:form[action="MaintPQEvents.html"]', timeout, error='Delete load profile buffer page not found')49 def go_to_reset_events_page(self, timeout=None):50 self._sel.go_to(self._device.get_device_address('/MaintPQEvents.html'))51 self._sel.wait_until_page_contains_element('css:form[action="MaintPQEvents.html"]', timeout, error='Delete load profile buffer page not found')52 def go_to_transient_log_page(self, timeout=None):53 self._sel.go_to(self._device.get_device_address('/MaintTransientLog.html'))54 self._sel.wait_until_page_contains_element('css:form[action="MaintTransientLog.html"]', timeout, error='Transient log page not found')55 def go_to_maint_operational_log_page(self, timeout=None):56 self._sel.go_to(self._device.get_device_address('/MaintOpLog.html'))57 self._sel.wait_until_page_contains_element('css:form[action="MaintOpLog.html"]', timeout, error='Maintenance operational log page not found')58 def go_to_maint_error_log_page(self, timeout=None):59 self._sel.go_to(self._device.get_device_address('/MaintErrorLog.html'))60 self._sel.wait_until_page_contains_element('css:form[action="MaintErrorLog.html"]', timeout, error='Maintenance error log page not found')61 def go_to_audit_log_page(self, timeout=None):62 self._sel.go_to(self._device.get_device_address('/MaintSecurityLog.html'))63 self._sel.wait_until_page_contains_element('css:form[action="MaintSecurityLog.html"]', timeout, error='Audit log page not found')64 def go_to_diagnosis_iec61850_page(self, timeout=None):65 self._sel.go_to(self._device.get_device_address('/MaintDiagIEC61850.html'))66 self._sel.wait_until_page_contains_element('css:form[action="MaintDiagIEC61850.html"]', timeout, error='Diagnosis iec61850 page not found')67 def go_to_customer_support_functions_page(self, timeout=None):68 self._sel.go_to(self._device.get_device_address('/MaintDiagPages.html'))69 self._sel.wait_until_page_contains_element('css:form[action="MaintDiagPages.html"]', timeout, error='Customer support function page not found')70 def go_to_view_load_profile_page(self, timeout=None):71 self._sel.go_to(self._device.get_device_address('/ViewLoadProfile.html'))72 self._sel.wait_until_page_contains_element('css:form[action="ViewLoadProfile.html"]', timeout, error='View load profile page not found')73 def go_to_harmonics_voltage_page(self, timeout=None):74 self._sel.go_to(self._device.get_device_address('/ViewAcHarmonicsVoltage.html'))75 self._sel.wait_until_page_contains_element('css:form[action="ViewAcHarmonicsVoltage.html"]', timeout, error='Harmonics voltage page not found')76 def go_to_harmonics_current_page(self, timeout=None):77 self._sel.go_to(self._device.get_device_address('/ViewAcHarmonicsCurrent.html'))78 self._sel.wait_until_page_contains_element('css:form[action="ViewAcHarmonicsCurrent.html"]', timeout, error='Harmonics current page not found')79 def go_to_harmonics_power_page(self, timeout=None):80 self._sel.go_to(self._device.get_device_address('/ViewAcHarmonicsPower.html'))81 self._sel.wait_until_page_contains_element('css:form[action="ViewAcHarmonicsPower.html"]', timeout, error='Harmonics power page not found')82 def go_to_harmonics_power_direction_page(self, timeout=None):83 self._sel.go_to(self._device.get_device_address('/ViewAcHarmonicsDirection.html'))84 self._sel.wait_until_page_contains_element('css:form[action="ViewAcHarmonicsDirection.html"]', timeout, error='Harmonics power direction page not found')85 def go_to_interharmonics_voltage_page(self, timeout=None):86 self._sel.go_to(self._device.get_device_address('/ViewAcInterHarmonicsVoltage.html'))87 self._sel.wait_until_page_contains_element('css:form[action="ViewAcInterHarmonicsVoltage.html"]', timeout, error='Interharmonics voltage page not found')88 def go_to_interharmonics_current_page(self, timeout=None):89 self._sel.go_to(self._device.get_device_address('/ViewAcInterHarmonicsCurrent.html'))90 self._sel.wait_until_page_contains_element('css:form[action="ViewAcInterHarmonicsCurrent.html"]', timeout, error='Interharmonics current page not found')91 def go_to_view_msv_page(self, timeout=None):92 self._sel.go_to(self._device.get_device_address('/ViewMainsSIGVoltage.html'))93 self._sel.wait_until_page_contains_element('css:form[action="ViewMainsSIGVoltage.html"]', timeout, error='View MSV page not found')94 def go_to_view_meas_recorder_page(self, timeout=None):95 self._sel.go_to(self._device.get_device_address('/ViewMeasurementRecord.html'))96 self._sel.wait_until_page_contains_element('css:form[action="ViewMeasurementRecord.html"]', timeout, error='View measurement recorder page not found')97 def go_to_view_trend_recorder_page(self, timeout=None):98 self._sel.go_to(self._device.get_device_address('/ViewTrendRecord.html'))99 self._sel.wait_until_page_contains_element('css:form[action="ViewTrendRecord.html"]', timeout, error='View trend recorder page not found')100 def go_to_view_records_page(self, timeout=None):101 self._sel.go_to(self._device.get_device_address('/ViewRecord.html'))102 self._sel.wait_until_page_contains_element('css:form[action="ViewRecord.html"]', timeout, error='View records page not found')103 def go_to_file_transfer_page(self, timeout=None):104 self._sel.go_to(self._device.get_device_address('/ViewFileTransfer.html'))105 self._sel.wait_until_page_contains_element('css:form[action="ViewFileTransfer.html"]', timeout, error='File transfer page not found')106 def go_to_configure_limit_page_one(self, timeout=None):107 self._sel.go_to(self._device.get_device_address('/ConfMeasurandLimits.html?Page_1'))108 self._sel.wait_until_page_contains_element('css:form[action="ConfMeasurandLimits.html"]', timeout, error='Configure limit page one not found')109 def go_to_configure_limit_page_two(self, timeout=None):110 self._sel.go_to(self._device.get_device_address('/ConfMeasurandLimits.html?Page_2'))111 self._sel.wait_until_page_contains_element('css:form[action="ConfMeasurandLimits.html"]', timeout, error='Configure limit page two not found')112 def go_to_configure_group_indication_page(self, timeout=None):113 self._sel.go_to(self._device.get_device_address('/ConfGroupIndications.html'))114 self._sel.wait_until_page_contains_element('css:form[action="ConfGroupIndications.html"]', timeout, error='Configure group indication page not found')115 def go_to_configure_binary_output_page(self, timeout=None):116 self._sel.go_to(self._device.get_device_address('/ConfBinaryOutputs.html'))117 self._sel.wait_until_page_contains_element('css:form[action="ConfBinaryOutputs.html"]', timeout, error='Configure binary output page not found')...

Full Screen

Full Screen

swiggy.py

Source:swiggy.py Github

copy

Full Screen

...61# This Fucntion will search restaurent name62 def search_restaurent(self,restaurent_name):63 self.obj._info('Searching for restaurent name')64 xpath= "xpath= //span[contains(text(),'Search')]"65 self.obj.wait_until_page_contains_element(xpath,timeout=90) #Wait till Search option comes up66 self.obj.click_element(xpath)67 xpath= "xpath=//input[@placeholder='Search for restaurants or dishes']" #Write name of restaurent68 self.obj.wait_until_page_contains_element(xpath,timeout=90)69 self.obj.wait_until_element_is_visible(xpath,timeout=90)70 self.obj.element_should_be_visible(xpath)71 self.obj.input_text("xpath=//input[@placeholder='Search for restaurants or dishes']",restaurent_name)72 xpath= "xpath= //div[contains(text(),'"+restaurent_name+"')]"73 self.obj.wait_until_page_contains_element(xpath,timeout=90)74 self.obj.wait_until_element_is_visible(xpath,timeout=90)75 #Click on restaurent name76 xpath= "xpath=//div[contains(text(),'"+restaurent_name+"')]"77 self.obj.click_element(xpath)78 xpath= "xpath= //h2[contains(text(),'Recommended')]" #Wait till text is shown and loaded fully79 self.obj.wait_until_page_contains_element(xpath,timeout=90)80 self.obj.wait_until_element_is_visible(xpath,timeout=90)81# This Fucntion will select items which will order82 def select_items_to_order(self,item,item_cnt):83 self.obj._info('Choose item to add-%s-%s'%(item,item_cnt))84 xpath= "xpath=//div[@class='_2SyqU'][contains(text(),'"+item+"')]/../../../../div[3]/div[2]/div[text()='ADD']" #Click on Add button85 self.obj._info('Adding Item with xpath-%s'%xpath)86 self.obj.wait_until_page_contains_element(xpath,timeout=90)87 self.obj.click_element(xpath)88 xpath= "//div[@class='_2SyqU'][contains(text(),'"+item+"')]/../../../../div[3]/div[2]/div[4]" #Get cake count, Will use it to order89 count= self.obj.get_text(xpath)90 self.obj._info('count is:%s'%count)91 if int(item_cnt)>int(count):92 loop_cnt= int(item_cnt)-int(count)93 plus_xpath= "xpath=//div[@class='_2SyqU'][contains(text(),'"+item+"')]/../../../../div[3]/div[2]/div[2]" #Click on + sign to add94 self.obj._info(plus_xpath)95 for c in range(int(loop_cnt)):96 self.obj._info('Click plus sign-%s'%c)97 self.obj.click_element(plus_xpath)98# This Fucntion will input all text during signup#99 def checkout_and_get_all_items_on_checkout_page(self):100 self.obj._info('Checkout now..')101 xpath= "xpath= //div[@class='_1gPB7']" #click on checkout button102 self.obj.click_element(xpath)103 xpath= "//div[@class='_2pdCL']/div"104 self.obj._info(xpath)105 self.obj.wait_until_page_contains_element(xpath,timeout=90) #Wait until checkout done and moved to next page106 count_of_itemtype= self.obj.get_matching_xpath_count(xpath)107 self.obj._info(count_of_itemtype)108 i= 1109 self.item_hash= {}110 baseurl= "xpath=//div[@class='_2pdCL']"111 while i<=int(count_of_itemtype):112 itemurl= baseurl+"/div["+str(i)+"]/div[1]/div[2]" #Get name of item113 self.obj.wait_until_page_contains_element(itemurl,timeout=90)114 itemname= self.obj.get_text(itemurl)115 itemurlcount= baseurl+"/div["+str(i)+"]/div[2]/div/div[1]/div[4]" #Get count of item116 self.obj.wait_until_page_contains_element(itemurlcount,timeout=90)117 itemcount= self.obj.get_text(itemurlcount)118 #create a hash119 self.item_hash[itemname]= itemcount #create hash with item and count120 i= i+1121 self.obj._info('Hash of items and count on checkout page-%s'%self.item_hash)122# This Fucntion will verify items on checkout page#123 def verify_items_on_checkout_page(self,item,item_cnt):124 self.obj._info('Verify item count on checkout page for:-%s'%item)125 self.obj._info('Expected count-%s Actual count-%s'%(item_cnt,self.item_hash[item]))126 if int(item_cnt)!=int(self.item_hash[item]):127 raise Exception('Item count not matching for %s .. Failure...'%item)128 else:129 self.obj._info('Item count matching for %s .. Great...'%item)130# This Fucntion will input all text during signup#131 def signup(self,mobileno,name,email,password):132 self.obj._info('Sign up..')133 xpath= "xpath=//div[contains(text(),'SIGN UP')]" #Click on signup button, class is static/constant134 self.obj._info(xpath)135 self.obj.click_element(xpath)136 #Input mobile number137 self.obj.input_text("id=mobile",mobileno)138 self.obj.input_text("id=name",name)139 self.obj.input_text("id=email",email)140 self.obj.input_text("id=password",password)141 #Click on referal code142 xpath= "xpath=//div[@class='_3GOZo']" #click on referal code icon, class is static/constant143 self.obj._info('Xpath is:%s'%xpath)144 self.obj.wait_until_page_contains_element(xpath,timeout=90)145 self.obj.click_element(xpath)146 #click on continue signup147 xpath= "xpath=//a[@class='_2REYC']" #click on continue button, class is static/constant148 self.obj._info('Xpath is:%s'%xpath)149 self.obj.wait_until_page_contains_element(xpath,timeout=90)150 self.obj.click_element(xpath)151 xpath= "xpath=//input[@id='email']/../label"152 self.obj.wait_until_page_contains_element(xpath,timeout=90) #Wait till message inside email text box not visible153 label= self.obj.get_text(xpath)154 self.obj._info(label)155# This Fucntion will check error message while doing signup#156 def verify_email_error_and_take_screenshot(self):157 xpath= "xpath=//input[@id='email']/../label"158 self.obj.wait_until_page_contains_element(xpath,timeout=90) #Wait till message inside email text box not visible159 label= self.obj.get_text(xpath)160 self.obj._info(label)161 if str(label)=='Invalid email address': #Compare email box error label162 self.obj._info("seems Error message related to email field")163 #Capture screenshot164 self.obj.capture_page_screenshot()165# This Fucntion will update cart items on checkout page#166 def update_items_during_checkout(self,item,item_cnt):167 self.obj._info('Choose item to update with count-%s-%s'%(item,item_cnt))168 xpath= "//div[contains(text(),'"+item+"')]/../../div[2]/div/div[1]/div[4]" #xpath used to count no of items in checkout page169 count= self.obj.get_text(xpath)170 self.obj._info('count is:%s'%count)171 if int(count)>int(item_cnt):172 loop_cnt= int(count)-int(item_cnt)173 minus_xpath= "xpath=//div[contains(text(),'"+item+"')]/../../div[2]/div/div[1]/div[3]" #Update item count in cart174 self.obj._info(minus_xpath)175 for c in range(int(loop_cnt)):176 self.obj._info('Click Minus sign during checkout-%s'%c)177 self.obj.click_element(minus_xpath)178 #Wait until loading is done if any179 xpath= "//div[contains(text(),'"+item+"')]/../../div[2]/div/div[1]/div[4]"180 self.obj.wait_until_page_contains_element(xpath,timeout=90)181 self.obj._info('Capture current screenshot & close Browser')...

Full Screen

Full Screen

StoreModel.py

Source:StoreModel.py Github

copy

Full Screen

...11 self.driver = None12 def set_driver(self, driver: SeleniumLibrary):13 self.driver = driver14 def title_choose_store(self,test=False):15 self.driver.wait_until_page_contains_element(16 store_locators.get("text_title_from"), timeout="30s"17 )18 if test is False:19 sleep(3)20 self.driver.click_element(store_locators.get("button_next_choose_store"))21 self.driver.wait_until_page_contains_element(22 store_locators.get("button_next_choose_store"), timeout="20s"23 )24 self.driver.wait_until_element_is_visible(25 store_locators.get("button_next_choose_store"), timeout="10s"26 )27 self.driver.click_element(store_locators.get("button_next_choose_store"))28 def choose_store(self, test=False):29 self.driver.wait_until_page_contains_element(30 store_locators.get("text_title_from"), timeout="10s"31 )32 self.driver.wait_until_page_contains_element(33 store_locators.get("select_choose_store"), timeout="10s"34 )35 if test is False:36 sleep(3)37 self.driver.click_element(store_locators.get("select_choose_store"))38 self.driver.wait_until_page_contains_element(39 store_locators.get("option_choose_store"), timeout="20s"40 )41 self.driver.wait_until_element_is_visible(42 store_locators.get("option_choose_store"), timeout="10s"43 )44 self.driver.click_element(store_locators.get("option_choose_store"))45 self.driver.wait_until_element_is_not_visible(46 store_locators.get("option_choose_store"), timeout="10s"47 )48 def click_button_next_choose_store(self):49 self.driver.click_button(store_locators.get("button_next_choose_store"))50 def text_title(self):51 self.driver.wait_until_page_contains_element(52 store_locators.get("text_title"), timeout="30s")53 def click_button_cancel_choose_store(self):54 self.driver.click_button(55 store_locators.get("button_cancel_choose_store")56 )57 sleep(5)58 def check_message_error_from_choose_store(self, text):59 self.driver.element_text_should_be(60 store_locators.get("message_error_from"),61 text,...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run robotframework-appiumlibrary automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful