How to use page_should_contain_element method in Robotframework-anywherelibrary

Best Python code snippet using robotframework-anywherelibrary

RelationshipsSettingsPageObject.py

Source:RelationshipsSettingsPageObject.py Github

copy

Full Screen

...108 """109 for field,value in kwargs.items():110 if str(field).lower() == "name":111 locator = eda_lex_locators["eda_settings_relationships"]["updtate_setting_name"].format(field,str(field).lower())112 self.selenium.page_should_contain_element(locator)113 self.selenium.clear_element_text(locator)114 locator = eda_lex_locators["eda_settings_relationships"]["update_setting_name_cleared"]115 self.selenium.get_webelement(locator).send_keys(value + Keys.TAB)116 else:117 time.sleep(5)118 locator = eda_lex_locators["eda_settings_relationships"]["update_setting_rest"].format(column,str(field).lower())119 self.selenium.page_should_contain_element(locator)120 self.selenium.clear_element_text(locator)121 self.selenium.get_webelement(locator).send_keys(value + Keys.TAB)122 def verify_new_setting_checkbox_status(self, **kwargs):123 """ Checks the expected status (True or False) of the checkbox for newly added setting124 Pass the expected value and field name from the tests125 true - checked, false - unchecked126 """127 for field,value in kwargs.items():128 locator = eda_lex_locators["eda_settings_relationships"]["new_setting_checkbox"].format(str(field).lower())129 actual_status = self.selenium.get_element_attribute(locator, "alt")130 if str(value).lower() != str(actual_status).lower():131 raise Exception(f"{field} checkbox value expected to be {value}, but actual is {actual_status}")132 def verify_new_setting_checkbox_status_edit_mode(self, **kwargs):133 """ Checks the expected status (True or False) of the checkbox for newly added in edit mode134 Pass the expected value and field name from the tests135 true - checked, false - unchecked136 """137 for field,value in kwargs.items():138 self.selenium.execute_javascript("window.scrollTo(0, document.body.scrollHeight)")139 time.sleep(5)140 locator = eda_lex_locators["eda_settings_relationships"]["new_setting_checkbox_edit"].format(str(field).lower())141 self.selenium.page_should_contain_element(locator)142 for i in range(5):143 i += 1144 time.sleep(5)145 actual_status = self.selenium.get_element_attribute(locator,"data-qa-checkbox-state")146 self.builtin.log(locator)147 self.builtin.log(actual_status)148 if str(actual_status).lower() == str(value).lower() or str(actual_status).lower() == "":149 self.builtin.log("The checkbox value in edit mode is" + actual_status)150 break151 raise Exception("Verifying 'Active checkbox' failed after multiple tries")152 def verify_new_reciprocal_setting(self,**kwargs):153 """ This method will validate the new reciprocal setting added recently which is always in154 in last row. Pass the name of the reciprocal relationship and its value as keyword args155 and this method will assign constant numeric value against each setting and validates156 the corresponding value157 """158 for field,value in kwargs.items():159 if str(field).lower() == "name":160 locator = eda_lex_locators["eda_settings_relationships"]["new_settings"].format(5,str(field).lower(),value)161 self.selenium.page_should_contain_element(locator)162 elif str(field).lower() == "female":163 locator = eda_lex_locators["eda_settings_relationships"]["new_settings"].format(4,str(field).lower(),value)164 self.selenium.page_should_contain_element(locator)165 elif str(field).lower() == "male":166 locator = eda_lex_locators["eda_settings_relationships"]["new_settings"].format(3,str(field).lower(),value)167 self.selenium.page_should_contain_element(locator)168 else:169 locator = eda_lex_locators["eda_settings_relationships"]["new_settings"].format(2,str(field).lower(),value)170 self.selenium.page_should_contain_element(locator)171 def verify_new_autocreation_setting(self,**kwargs):172 """ This method will validate the new autocreation setting added recently which is always in173 in last row. Pass the name of the autocreation relationship and its value as keyword args174 and this method will assign constant numeric value against each setting and validates175 the corresponding value176 """177 for field,value in kwargs.items():178 if str(field).lower() == "object":179 locator = eda_lex_locators["eda_settings_relationships"]["new_settings_autoc"].format(4,str(field).lower(),value)180 self.selenium.page_should_contain_element(locator)181 elif str(field).lower() == "field":182 locator = eda_lex_locators["eda_settings_relationships"]["new_settings_autoc"].format(3,str(field).lower(),value)183 self.selenium.page_should_contain_element(locator)184 elif str(field).lower() == "type":185 locator = eda_lex_locators["eda_settings_relationships"]["new_settings_autoc"].format(2,str(field).lower(),value)186 self.selenium.page_should_contain_element(locator)187 else:188 locator = eda_lex_locators["eda_settings_relationships"]["new_settings_autoc"].format(1,str(field).lower(),value)189 self.selenium.page_should_contain_element(locator)190 def verify_reciprocal_setting_edit_mode(self,**kwargs):191 """ This method will validate the new reciprocal setting added recently which is always in192 in last row in edit mdoe. Pass the name of the reciprocal relationship and its value as193 keyword args and this method will assign constant numeric value against each setting194 and validates the corresponding value195 """196 for field,value in kwargs.items():197 if str(field).lower() == "name":198 locator = eda_lex_locators["eda_settings_relationships"]["new_setting_edit"].format(5,str(field).lower(),field,value)199 self.selenium.page_should_contain_element(locator)200 elif str(field).lower() == "female":201 locator = eda_lex_locators["eda_settings_relationships"]["new_setting_edit"].format(4,str(field).lower(),field,value)202 self.selenium.page_should_contain_element(locator)203 elif str(field).lower() == "male":204 locator = eda_lex_locators["eda_settings_relationships"]["new_setting_edit"].format(3,str(field).lower(),field,value)205 self.selenium.page_should_contain_element(locator)206 else:207 locator = eda_lex_locators["eda_settings_relationships"]["new_setting_edit"].format(2,str(field).lower(),field,value)208 self.selenium.page_should_contain_element(locator)209 def verify_autocreation_setting_edit_mode(self,**kwargs):210 """ This method will validate the new autocreation setting added recently which is always in211 in last row in edit mdoe. Pass the name of the autocreation relationship and its value as212 keyword args and this method will assign constant numeric value against each setting213 and validates the corresponding value214 """215 for field,value in kwargs.items():216 if str(field).lower() == "object":217 locator = eda_lex_locators["eda_settings_relationships"]["new_autoc_setting_edit"].format(4,str(field).lower(),field,value)218 self.selenium.page_should_contain_element(locator)219 elif str(field).lower() == "field":220 locator = eda_lex_locators["eda_settings_relationships"]["new_autoc_setting_edit"].format(3,str(field).lower(),field,value)221 self.selenium.page_should_contain_element(locator)222 elif str(field).lower() == "type":223 locator = eda_lex_locators["eda_settings_relationships"]["new_autoc_setting_edit"].format(2,str(field).lower(),field,"")224 self.selenium.page_should_contain_element(locator)225 else:226 locator = eda_lex_locators["eda_settings_relationships"]["new_campaign_types_edit"].format(1,str(field).lower(),"Campaign Types",value)227 self.selenium.page_should_contain_element(locator)228 def verify_settings_count(self, settings_count, actual_count, expected):229 """ This method will compare the reciprocal relationship settings count. It accepts initial230 count, updated count and expected status as arguments231 """232 if str(expected).lower() == "true":233 no_of_records = actual_count - settings_count234 self.builtin.log(no_of_records)235 if no_of_records > 0:236 return int(actual_count)237 else:238 raise Exception("The reciprocal settings are not updated")239 else:240 if actual_count == settings_count:241 no_of_records = actual_count - settings_count242 self.builtin.log(no_of_records)243 return int(actual_count)244 else:245 raise Exception("The reciprocal settings are updated")246 def verify_setting_deleted(self,expectedStatus, **kwargs):247 """ This method will verify the setting is deleted or not based on the expected status sent248 Pass the name of the field and its value as keyword arguments and expected status249 """250 for field,value in kwargs.items():251 locator = eda_lex_locators["eda_settings_relationships"]["delete_setting_icon"].format(field,value)252 if str(expectedStatus).lower() == "true":253 self.selenium.page_should_not_contain_element(locator)254 else:255 self.selenium.page_should_contain_element(locator)256 def verify_setting_removed(self,**kwargs):257 """ This method will verify the setting is removed or not based on the expected status sent258 in read mode. Pass the name of the field and its value as keyword arguments and259 expected status260 """261 for field,value in kwargs.items():262 if str(field).lower() == "name":263 locator = eda_lex_locators["eda_settings_relationships"]["removed_setting"].format(str(field).lower(),value)264 self.selenium.page_should_not_contain_element(locator)265 else:266 locator = eda_lex_locators["eda_settings_relationships"]["removed_autoc_setting"].format(str(field).lower(),value)267 self.selenium.page_should_not_contain_element(locator)268 def verify_updated_reciprocal_setting(self,column,**kwargs):269 """ This method will verify the updated reciprocal settings270 Pass the expected value to be verified along with field name as keyword arguments271 """272 for field,value in kwargs.items():273 if str(field).lower() == "name":274 locator = eda_lex_locators["eda_settings_relationships"]["removed_setting"].format(str(field).lower(),value)275 self.selenium.page_should_contain_element(locator)276 else:277 locator = eda_lex_locators["eda_settings_relationships"]["updated_setting"].format(column,str(field).lower(),value)...

Full Screen

Full Screen

flows.py

Source:flows.py Github

copy

Full Screen

...38 self.input_text(OR["login_password"], pwd)39 self.click_element(OR["login_button"])40 #now verify we are on the correct page41 if not positive_test:42 self.page_should_contain_element(OR["login_banner"])43 else:44 #this is generally an error msg saying user already logged in45 if self._quick_check(4,self._is_element_present,OR["login_info"]): 46 logger.warn("Error msg saying %s trying to continue " % self._get_text(OR["login_info"]))47 self.click_element(OR["login_button"])48 self._wait_for_loading_div_to_clear()49 self.page_should_contain_element(OR["mainpage_banner"])50 def euh_EWS_Logoff(self,confirmation_button="Yes",positive_test=True):51 self.click_element(OR["logoff_link"])52 self.euh_click_button(button_name=confirmation_button,wait_for_loading=False)53 if positive_test:54 self.page_should_contain_element(OR["login_banner"])55 else:56 self.page_should_contain_element(OR["mainpage_banner"])57 def euh_navigate_to_specific_tab(self, module_name, sub_module_name, tab_name=None, index=0):58 '''TODO: index is not yet implemented'''59 self._wait_for_loading_div_to_clear()60 self._info("about to click module %s" % (module_name))61 module = self._get_euh_top_menu_button(module_name)62 self._wait_for_loading_div_to_clear()63 if not self._wait_and_click(module):64 #sometimes we are too fast, so let's just try it again.65 self._info("Couldn't click % module button, trying again" % (module_name))66 module = self._get_euh_top_menu_button(module_name)67 self._wait_and_click(module)68 self._info("about to click sub module %s" % (sub_module_name)) 69 self._wait_for_loading_div_to_clear()70 sub_module = self._get_euh_top_menu_button(sub_module_name)...

Full Screen

Full Screen

busca.py

Source:busca.py Github

copy

Full Screen

...45 self.selib.click_element(self.locator.div_product)46 def validate_product(self):47 """Validate success modal of new router"""48 self.selib.wait_until_element_is_visible(self.locator.btn_add_produto)49 self.selib.page_should_contain_element(self.locator.btn_add_produto)50 self.selib.wait_until_element_is_visible(self.locator.span_produto_gelado)51 self.selib.page_should_contain_element(self.locator.span_produto_gelado)52 self.selib.wait_until_element_is_visible(self.locator.fig_produto)...

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-anywherelibrary 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