How to use is_element_present method in Robotframework-anywherelibrary

Best Python code snippet using robotframework-anywherelibrary

main_page.py

Source:main_page.py Github

copy

Full Screen

...29 login_link = self.driver.find_element(*self.LOGIN_LINK)30 login_link.click()31 def enter_email(self, email):32 email_link = self.driver.find_element(*self.EMAIL_LINK)33 assert self.is_element_present(*self.EMAIL_LINK), "Email link is not presented"34 email_link.send_keys(email)35 allure.attach(self.driver.get_screenshot_as_png(),36 name="Screenshot", attachment_type=AttachmentType.PNG)37 def enter_password(self, password):38 password_link = self.driver.find_element(*self.PASSWORD_LINK)39 assert self.is_element_present(*self.PASSWORD_LINK), "Password link is not presented"40 password_link.send_keys(password)41 allure.attach(self.driver.get_screenshot_as_png(),42 name="Screenshot", attachment_type=AttachmentType.PNG)43 def click_button_authorization(self):44 login_button_link = self.driver.find_element(*self.LOGIN_BUTTON_LINK)45 assert self.is_element_present(*self.LOGIN_BUTTON_LINK), "Login button is not presented"46 login_button_link.click()47 allure.attach(self.driver.get_screenshot_as_png(),48 name="Screenshot", attachment_type=AttachmentType.PNG)49 def click_change_avatar(self):50 change_button_link = self.driver.find_element(*self.CHANGE_BUTTON_LINK)51 assert self.is_element_present(*self.CHANGE_BUTTON_LINK), "Change avatar button is not presented"52 change_button_link.click()53 allure.attach(self.driver.get_screenshot_as_png(),54 name="Screenshot", attachment_type=AttachmentType.PNG)55 def choose_file(self, file):56 hide_button_link = self.driver.find_element(*self.HIDE_BUTTON_LINK)57 assert self.is_element_present(*self.HIDE_BUTTON_LINK), "Input avatar button is not presented"58 hide_button_link.send_keys(file)59 time.sleep(5)60 allure.attach(self.driver.get_screenshot_as_png(),61 name="Screenshot", attachment_type=AttachmentType.PNG)62 def click_button_apply(self):63 button_avatar_link = self.driver.find_element(*self.BUTTON_AVATAR_LINK)64 assert self.is_element_present(*self.BUTTON_AVATAR_LINK), "To apply button is not presented"65 button_avatar_link.click()66 def click_button_settings(self):67 settings_button_link = self.driver.find_element(*self.SETTINGS_BUTTON_LINK)68 assert self.is_element_present(*self.SETTINGS_BUTTON_LINK), "Settings button is not presented"69 settings_button_link.click()70 allure.attach(self.driver.get_screenshot_as_png(),71 name="Screenshot", attachment_type=AttachmentType.PNG)72 def click_change_password(self):73 password_change_link = self.driver.find_element(*self.PASSWORD_CHANGE_LINK)74 assert self.is_element_present(*self.PASSWORD_CHANGE_LINK), "Change password is not presented"75 password_change_link.click()76 allure.attach(self.driver.get_screenshot_as_png(),77 name="Screenshot", attachment_type=AttachmentType.PNG)78 def enter_old_password(self, old_password):79 password_now_link = self.driver.find_element(*self.PASSWORD_NOW_LINK)80 assert self.is_element_present(*self.PASSWORD_NOW_LINK), "Now password is not presented"81 password_now_link.send_keys(old_password)82 allure.attach(self.driver.get_screenshot_as_png(),83 name="Screenshot", attachment_type=AttachmentType.PNG)84 def enter_new_password(self, new_password):85 password_new_link = self.driver.find_element(*self.PASSWORD_NEW_LINK)86 assert self.is_element_present(*self.PASSWORD_NEW_LINK), "New password is not presented"87 password_new_link.send_keys(new_password)88 allure.attach(self.driver.get_screenshot_as_png(),89 name="Screenshot", attachment_type=AttachmentType.PNG)90 def confirm_new_password(self, new_password):91 password_confirm_link = self.driver.find_element(*self.PASSWORD_CONFIRM_LINK)92 assert self.is_element_present(*self.PASSWORD_CONFIRM_LINK), "Confirm password is not presented"93 password_confirm_link.send_keys(new_password)94 allure.attach(self.driver.get_screenshot_as_png(),95 name="Screenshot", attachment_type=AttachmentType.PNG)96 def click_button_change_password(self):97 button_change_password_link = self.driver.find_element(*self.BUTTON_CHANGE_PASSWORD_LINK)98 assert self.is_element_present(*self.BUTTON_CHANGE_PASSWORD_LINK), \99 "Change password button is not presented "100 button_change_password_link.click()101 time.sleep(3)102 allure.attach(self.driver.get_screenshot_as_png(),103 name="Screenshot", attachment_type=AttachmentType.PNG)104 def should_be_login_link(self):105 assert self.is_element_present(*self.LOGIN_LINK), "Login link is not presented"106 allure.attach(self.driver.get_screenshot_as_png(),107 name="Screenshot", attachment_type=AttachmentType.PNG)108 def choose_Timezone(self, timezone):109 select_timezone = Select(self.driver.find_element(*self.SELECT_TIMEZONE))110 assert self.is_element_present(*self.SELECT_TIMEZONE), \111 "Select Timezone button is not presented "112 select_timezone.select_by_value(timezone)113 allure.attach(self.driver.get_screenshot_as_png(),114 name="Screenshot", attachment_type=AttachmentType.PNG)115 def click_Save(self):116 button_save = self.driver.find_element(*self.BUTTON_SAVE)117 assert self.is_element_present(*self.BUTTON_SAVE), \118 "Select Timezone button is not presented "119 button_save.click()120 allure.attach(self.driver.get_screenshot_as_png(),121 name="Screenshot", attachment_type=AttachmentType.PNG)122 def enter_name(self, name):123 name_input = self.driver.find_element(*self.NAME_INPUT)124 assert self.is_element_present(*self.NAME_INPUT), "Input Name is not presented"125 name_input.clear()126 name_input.send_keys(name)127 allure.attach(self.driver.get_screenshot_as_png(),128 name="Screenshot", attachment_type=AttachmentType.PNG)129 def enter_last_name(self, last_name):130 last_name_input = self.driver.find_element(*self.LAST_NAME_INPUT)131 assert self.is_element_present(*self.LAST_NAME_INPUT), "Input Name is not presented"132 last_name_input.clear()133 last_name_input.send_keys(last_name)134 allure.attach(self.driver.get_screenshot_as_png(),...

Full Screen

Full Screen

register_page.py

Source:register_page.py Github

copy

Full Screen

...37 self.enter_birthdate(birth)38 self.enter_description(descr)39 self.browser.find_element(*RegPageLocators.REG_BUTTON).click()4041 def is_element_present(self, how, what):42 try:43 WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((how, what)))44 self.browser.find_element(how, what)45 except (NoSuchElementException, TimeoutException):46 return False47 return True4849 def should_be_name_field(self):50 assert self.is_element_present(*RegPageLocators.NAME_FIELD), 'Can\'t find "Name" field'5152 def should_be_email_field(self):53 assert self.is_element_present(*RegPageLocators.EMAIL_FIELD), 'Can\'t find "Email" field'5455 def should_be_password_field(self):56 assert self.is_element_present(*RegPageLocators.PASSWORD_FIELD), 'Can\'t find "Password" field'5758 def should_be_repeat_password_field(self):59 assert self.is_element_present(*RegPageLocators.REPEAT_PASSWORD_FIELD), 'Can\'t find "Repeat password" field'6061 def should_be_birthday_field(self):62 assert self.is_element_present(*RegPageLocators.BIRTHDAY_FIELD), 'Can\'t find "Birthday" field'6364 def should_be_description_field(self):65 assert self.is_element_present(*RegPageLocators.DESCRIPTION_FIELD), 'Can\'t find "Description" field'6667 def should_be_register_button(self):68 assert self.is_element_present(*RegPageLocators.REG_BUTTON), 'Can\'t find "Register" button'6970 def enter_name(self, name):71 self.browser.find_element(*RegPageLocators.NAME_FIELD).send_keys(name)7273 def enter_email(self, email):74 self.browser.find_element(*RegPageLocators.EMAIL_FIELD).send_keys(email)7576 def enter_password(self, upass):77 self.browser.find_element(*RegPageLocators.PASSWORD_FIELD).send_keys(upass)7879 def enter_repeat_password(self, rpass):80 self.browser.find_element(*RegPageLocators.REPEAT_PASSWORD_FIELD).send_keys(rpass)8182 def enter_description(self, descr):83 self.browser.find_element(*RegPageLocators.DESCRIPTION_FIELD).send_keys(descr)8485 def enter_birthdate(self, birth):86 self.browser.find_element(*RegPageLocators.BIRTHDAY_FIELD).send_keys(birth)8788 def should_be_invalid_feedback(self):89 return self.is_element_present(*RegPageLocators.INVALID_FEEDBACK)9091 def register_success(self, text='',):92 try:93 WebDriverWait(self.browser, 5).until(EC.alert_is_present())94 alert = self.browser.switch_to.alert95 alert_text = alert.text96 alert.accept()97 print (alert_text, text)98 return True99 except NoAlertPresentException:100 print('Register error')101 return False102103

Full Screen

Full Screen

CareersPage.py

Source:CareersPage.py Github

copy

Full Screen

...16 def filter_job_by_location_and_department(self, location, department):17 self.filter_job_by_location(location)18 self.select_department(department)19 def is_culture_section_available(self):20 return self.is_element_present(CareersPageLocators.CULTURE_SECTION)21 def is_locations_section_available(self):22 return self.is_element_present(CareersPageLocators.LOCATIONS_SECTION)23 def is_teams_section_available(self):24 return self.is_element_present(CareersPageLocators.TEAMS_SECTION)25 def is_jobs_section_available(self):26 return self.is_element_present(CareersPageLocators.JOBS_SECTION)27 def is_life_section_available(self):28 return self.is_element_present(CareersPageLocators.LIFE_SECTION)29 def is_jobs_list_opened(self):30 return self.is_element_present(CareersPageLocators.JOBS_LIST)31 def are_departments_correct(self, department):32 return self.are_elements_contain_text(CareersPageLocators.JOBS_DEPARTMENTS, text=department)33 def are_locations_correct(self, locations):34 return self.are_elements_contain_text(CareersPageLocators.JOBS_LOCATIONS, text=locations)35 def are_positions_correct(self, positions):...

Full Screen

Full Screen

PositionPage.py

Source:PositionPage.py Github

copy

Full Screen

...5 self.wait_for_element_clickable(PositionPageLocators.APPLY_BUTTON, 5).click()6 def is_position_page_opened(self):7 return "Quality Assurance" in self.driver.title8 def is_description_displayed(self):9 return self.is_element_present(PositionPageLocators.JOB_DESCRIPTION)10 def are_valid_categories_opened(self, location, position):11 return location.upper() in self.driver.find_element(*PositionPageLocators.DESCRIPTION_LOCATION).text and\12 position.upper() in self.driver.find_element(*PositionPageLocators.DESCRIPTION_POSITION).text13 def are_requirements_displayed(self):14 return self.is_element_present(PositionPageLocators.JOB_REQUIREMENTS)15 def is_apply_button_displayed(self):16 return self.is_element_present(PositionPageLocators.JOB_REQUIREMENTS)17 def is_application_form_opened(self):...

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