class EventNominationTabPage: __e_arrow_down_class = Locators.NOMINATIONS['dropdown'] __e_header_tag = Locators.TAG['h6'] __e_button_xpath = Locators.BUTTONS['button'].format('Confirm') __e_ok_xpath = Locators.BUTTONS['all_buttons'].format('OK') __e_draw_xpath = Locators.BUTTONS['button'].format('Withdraw nomination') def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.scroll = PageScroll(self.driver) self.notifier = Notifier(self.driver) self.button = 'Withdraw nomination' def event_row_arrow_down(self): try: self.wait.web_element_wait_click(By.CLASS_NAME, self.__e_arrow_down_class, 'nomination_tab') print('Interviewers nomination_tab - Clicked') return True except Exception as error: ui_logger.error(error) def nomination_job_validation(self, job_name): try: assert self.wait.web_elements_wait_text(By.TAG_NAME, self.__e_header_tag, job_name) == job_name, \ 'Arrow down for wrong job role' return True except Exception as error: ui_logger.error(error) def confirm_interviewer_nomination(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_button_xpath, 'confirm_interviewer_nomination') print('confirm_interviewer_nomination - Clicked') return True except Exception as error: ui_logger.error(error) def ok_confirm(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_ok_xpath, 'ok_confirm') print('ok_confirm - Clicked') return True except Exception as error: ui_logger.error(error) def nomination_accept_validation(self): try: assert self.wait.web_elements_wait_text(By.XPATH, self.__e_draw_xpath, self.button) == self.button, \ 'Not confirmed YET' return True except Exception as error: ui_logger.error(error)
class AccountName: __e_account_name_settings_xpath = Locators.ACCOUNT['account_icon'] __e_settings_id = Locators.ACCOUNT['settings'] __e_anchor_tag = Locators.TAG['anchor'] def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.scroll = PageScroll(self.driver) def account_name_click(self): try: self.wait.web_element_wait_click( By.XPATH, self.__e_account_name_settings_xpath, 'account_name_click') return True except Exception as error: ui_logger.error(error) def login_account_name_verification(self, user_name): try: self.wait.loading() assert self.wait.web_elements_wait_text(By.TAG_NAME, self.__e_anchor_tag, user_name) == user_name, \ 'Logged in different account please check the details' return True except Exception as error: ui_logger.error(error) def account_settings(self): try: self.wait.web_element_wait_click(By.ID, self.__e_settings_id, 'account_settings') return True except Exception as error: ui_logger.error(error)
class ManageTaskScreen: __e_common_css = Locators.MANAGE_TASK['common_label'] __e_candidate_status_xpath = Locators.MANAGE_TASK['candidate_status'] __e_submit_xpath = Locators.TITLE['tooltip'].format("'", 'Candidate has submitted but not approved.', "'") __e_pending_xpath = Locators.TITLE['tooltip'].format("'", 'Candidate has not submitted.', "'") __e_reject_xpath = Locators.TITLE['tooltip'].format("'", 'Candidate has not corrected the details after the ' 'task(s) got rejected.', "'") __e_approved_xpath = Locators.TITLE['tooltip'].format("'", 'Task(s) are approved.', "'") __e_total_xpath = Locators.MANAGE_TASK['total'] def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.window = SwitchWindowClose(self.driver) def candidate_name_validate(self, candidate_name): try: value = self.wait.web_elements_wait_text(By.CSS_SELECTOR, self.__e_common_css, candidate_name) if candidate_name in value: print(f'Candidate Name is - {value}') return True except Exception as error: ui_logger.error(error) def candidate_stage_status_validate(self, stage_status): try: self.wait.web_element_wait_text(By.XPATH, self.__e_candidate_status_xpath, stage_status) if self.wait.text_value.strip() == stage_status: print(f'Manage candidate screen verified - {self.wait.text_value.strip()}') return True except Exception as error: ui_logger.error(error) def submitted_task_validate(self, submit_task): try: self.wait.web_element_wait_text(By.XPATH, self.__e_submit_xpath, 'submitted_task_validate') if self.wait.text_value == submit_task: print(f'Submitted tasks are - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def pending_task_validate(self, pending_task): try: self.wait.web_element_wait_text(By.XPATH, self.__e_pending_xpath, 'pending_task_validate') if self.wait.text_value == pending_task: print(f'Pending tasks are - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def rejected_task_validate(self, rejected_task): try: self.wait.web_element_wait_text(By.XPATH, self.__e_reject_xpath, 'rejected_task_validate') if self.wait.text_value == rejected_task: print(f'Rejected tasks are - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def approved_task_validate(self, approved_task): try: self.wait.web_element_wait_text(By.XPATH, self.__e_approved_xpath, 'approved_task_validate') if self.wait.text_value == approved_task: print(f'Approved tasks are - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def total_task_validate(self, total_task): try: self.wait.web_element_wait_text(By.XPATH, self.__e_total_xpath, 'total_task_validate') if self.wait.text_value == total_task: print(f'Total tasks are - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def switch_back_to_old_window(self): try: self.window.window_close() time.sleep(0.5) self.window.switch_to_window(1) time.sleep(0.5) self.window.window_close() time.sleep(0.5) self.window.switch_to_window(0) return True except Exception as error: ui_logger.error(error)
class CandidateLogin: """ ----------------- WEB ELEMENT REFERENCE CLASS PRIVATE VARIABLES TO EASY ACCESS ------>>>> """ __e_tenant_name = Locators.LOGIN['alias'] __e_login_name_l = Locators.LOGIN['c_user_name'] __e_password_xpath = Locators.LOGIN['password'] __e_login_button_class = Locators.LOGIN['login'] __e_anchor_tag = Locators.TAG['anchor'] def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.scroll = PageScroll(self.driver) self.new_tab = NewTab(self.driver) def candidate_login_url(self, server): if server == 'amsin': self.new_tab.open_in_same_tab( 0, ReadConfigFile.ReadConfig.get_qa_candidate_url()) return True elif server == 'ams': self.new_tab.open_in_same_tab( 0, ReadConfigFile.ReadConfig.get_production_candidate_url()) return True elif server == 'beta': self.new_tab.open_in_same_tab( 0, ReadConfigFile.ReadConfig.get_beta_candidate_url()) return True elif server == 'stage': self.new_tab.open_in_same_tab( 0, ReadConfigFile.ReadConfig.get_stage_candidate_url()) return True elif server == 'india': self.new_tab.open_in_same_tab( 0, ReadConfigFile.ReadConfig.get_indiaams_candidate_url()) return True def login_name(self, login_name): try: time.sleep(3) self.wait.web_element_wait_send_keys(By.NAME, self.__e_login_name_l, login_name, 'login_name_field') return True except Exception as error: ui_logger.error(error) def password(self, password): try: self.wait.web_element_wait_send_keys(By.XPATH, self.__e_password_xpath, password, 'login_password_field') return True except Exception as error: ui_logger.error(error) def login_button(self): try: self.wait.web_element_wait_click(By.CLASS_NAME, self.__e_login_button_class, 'login_button') return True except Exception as error: ui_logger.error(error) def login_account_name_verification(self, user_name): try: self.wait.loading() assert self.wait.web_elements_wait_text(By.TAG_NAME, self.__e_anchor_tag, user_name) == user_name, \ 'Logged in different account please check the details' return True except Exception as error: ui_logger.error(error)
class EventNominationsPage: __e_nomination_tab_xpath = Locators.SUB_MENU['nominations'] __e_header_tag = Locators.TAG['h5'] __e_panel_xpath = Locators.NOMINATIONS['panel_select'] __e_check_xpath = Locators.CHECK_BOX['check_box'] __e_action_class = Locators.NOMINATIONS['actions'] __e_approve_xpath = Locators.NOMINATIONS['approve'] __e_sync_xpath = Locators.TITLE['title'].format( 'This will sync interviewers for whom you' ' have accepted nomination with the event owners') def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.scroll = PageScroll(self.driver) self.notifier = Notifier(self.driver) def nomination_tab(self): try: self.wait.loading() self.wait.web_element_wait_click(By.XPATH, self.__e_nomination_tab_xpath, 'nomination_tab') print('Interviewers nomination_tab - Clicked') return True except Exception as error: ui_logger.error(error) def header_check(self, header): try: self.wait.loading() assert self.wait.web_elements_wait_text(By.TAG_NAME, self.__e_header_tag, header) == header, \ 'no header found' return True except Exception as error: ui_logger.error(error) def panel_select(self, skill): try: self.wait.web_element_wait_send_keys(By.XPATH, self.__e_panel_xpath, skill, 'panel_select') self.wait.loading() print(f'{skill} - skill selected to panel') return True except Exception as error: ui_logger.error(error) def select_applicants(self): try: time.sleep(1) self.wait.web_element_wait_click(By.XPATH, self.__e_check_xpath, 'select_applicants') print('select_applicants - Selected') return True except Exception as error: ui_logger.error(error) def recruiter_actions(self): try: self.wait.web_element_wait_click(By.CLASS_NAME, self.__e_action_class, 'recruiter_actions') print('recruiter_actions - Clicked') return True except Exception as error: ui_logger.error(error) def approve_by_recruiter(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_approve_xpath, 'recruiter_actions') self.wait.loading() print('recruiter_actions - Clicked') return True except Exception as error: ui_logger.error(error) def sync_interviewers(self): try: self.scroll.up(0, 90) time.sleep(1.5) self.wait.web_element_wait_click(By.XPATH, self.__e_sync_xpath, 'sync_interviewers') print('sync_interviewers - Synced') return True except Exception as error: ui_logger.error(error) def sync_notifier(self, message): try: self.notifier.glowing_messages(message) return True except Exception as error: ui_logger.error(error) def sync_notifier_dismiss(self): try: self.notifier.dismiss_message() return True except Exception as error: ui_logger.error(error)
class Login: """ ----------------- WEB ELEMENT REFERENCE CLASS PRIVATE VARIABLES TO EASY ACCESS ------>>>> """ __e_tenant_name = Locators.LOGIN['alias'] __e_next_button_css = Locators.LOGIN['next'] __e_login_name_l = Locators.LOGIN['login_name'] __e_password_xpath = Locators.LOGIN['password'] __e_login_button_css = Locators.LOGIN['login'] __e_anchor_tag = Locators.TAG['anchor'] __e_logout_id = Locators.LOGIN['logout'] __e_click_xpath = Locators.LOGIN['click_to_login'] def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.scroll = PageScroll(self.driver) def tenant(self, tenant_name): self.wait.web_element_wait_send_keys(By.NAME, self.__e_tenant_name, tenant_name, 'login_tenant_field') def next_button(self): self.wait.web_element_wait_click(By.CSS_SELECTOR, self.__e_next_button_css, 'login_next_button') def login_name(self, login_name): try: time.sleep(1.5) self.wait.web_element_wait_send_keys(By.NAME, self.__e_login_name_l, login_name, 'login_name_field') return True except Exception as error: ui_logger.error(error) def password(self, password): try: self.wait.web_element_wait_send_keys(By.XPATH, self.__e_password_xpath, password, 'login_password_field') return True except Exception as error: ui_logger.error(error) def login_button(self): try: self.wait.web_element_wait_click(By.CLASS_NAME, self.__e_login_button_css, 'login_button') return True except Exception as error: ui_logger.error(error) def login_account_name_verification(self, user_name): try: self.wait.loading() assert self.wait.web_elements_wait_text(By.TAG_NAME, self.__e_anchor_tag, user_name) == user_name, \ 'Logged in different account please check the details' return True except Exception as error: ui_logger.error(error) def login_account_click(self, user_name): try: self.wait.web_elements_wait_click(By.TAG_NAME, self.__e_anchor_tag, user_name) print(f'Current account name is - {user_name}') return True except Exception as error: ui_logger.error(error) def login_out(self): try: time.sleep(0.5) self.scroll.up(0, 60) time.sleep(0.5) self.wait.web_element_wait_click(By.ID, self.__e_logout_id, 'Logout from account') print('Logging Out - from application') return True except Exception as error: ui_logger.error(error) def click_here_to_login(self): try: time.sleep(2) self.wait.web_element_wait_click(By.XPATH, self.__e_click_xpath, 'Logout from account') print('Re-login - Clicked for login screen') return True except Exception as error: ui_logger.error(error)
class EmbraceLogin: """ ----------------- WEB ELEMENT REFERENCE CLASS PRIVATE VARIABLES TO EASY ACCESS ------>>>> """ __e_login_name = Locators.LOGIN['c_user_name'] __e_password_xpath = Locators.LOGIN['password'] __e_login_button_xpath = Locators.LOGIN['e_login'] __e_login_verify_name = 'headerNameText' def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.scroll = PageScroll(self.driver) self.new_tab = NewTab(self.driver) def embrace_url(self, server): if server == 'amsin': self.new_tab.open_in_same_tab(0, ReadConfigFile.ReadConfig.get_qa_embrace_url()) return True elif server == 'ams': self.new_tab.open_in_same_tab(0, ReadConfigFile.ReadConfig.get_production_embrace_url()) return True elif server == 'beta': self.new_tab.open_in_same_tab(0, ReadConfigFile.ReadConfig.get_beta_embrace_url()) return True elif server == 'stage': self.new_tab.open_in_same_tab(0, ReadConfigFile.ReadConfig.get_stage_embrace_url()) return True elif server == 'india': self.new_tab.open_in_same_tab(0, ReadConfigFile.ReadConfig.get_indiaams_embrace_url()) return True def login_name(self, login_name): try: time.sleep(3) self.wait.web_element_wait_send_keys(By.NAME, self.__e_login_name, login_name, 'login_name_field') return True except Exception as error: ui_logger.error(error) def password(self, password): try: self.wait.web_element_wait_send_keys(By.XPATH, self.__e_password_xpath, password, 'login_password_field') return True except Exception as error: ui_logger.error(error) def login_button(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_login_button_xpath, 'login_button') return True except Exception as error: ui_logger.error(error) def login_account_name_verification(self, user_name): try: self.wait.embrace_loading() time.sleep(1) assert self.wait.web_elements_wait_text(By.CLASS_NAME, self.__e_login_verify_name, user_name) == \ user_name, 'Logged in different account please check the details' print(f'{user_name} logged in successfully') return True except Exception as error: ui_logger.error(error)