class JobCreationPage: """ ----------------- WEB ELEMENT REFERENCE CLASS PRIVATE VARIABLES TO EASY ACCESS ------>>>> """ __e_create = Locators.BUTTONS['create'] __e_job_names = Locators.JOB['job_name'] __e_anchor_tag = Locators.TAG['anchor'] __e_file_path = Locators.ATTACHMENT['file'] __e_description = Locators.JOB['description'] __e_location = Locators.PLACEHOLDER['text_ph'].format('Location') __e_hm = Locators.PLACEHOLDER['text_ph'].format('Hiring Manager') __e_bu = Locators.PLACEHOLDER['text_ph'].format('Business Unit') __e_openings = Locators.JOB['openings'] __e_male = Locators.PLACEHOLDER['num_ph'].format('Male') __e_female = Locators.PLACEHOLDER['num_ph'].format('Female') __e_job_create = Locators.BUTTONS['button'].format('Create') def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.notifier = Notifier(self.driver) def create_button(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_create, 'Job Create Button') print('***--------->>> Clicked on job created button') self.wait.loading() return True except Exception as error: ui_logger.error(error) def job_name(self, name): try: self.wait.web_element_wait_send_keys(By.XPATH, self.__e_job_names, name, 'Job_name_field') return True except Exception as error: ui_logger.error(error) def job_attachment(self, file_path): try: self.wait.web_element_wait_send_keys(By.XPATH, self.__e_file_path, file_path, 'Job_attachment') time.sleep(0.5) self.wait.uploading() return True except Exception as error: ui_logger.error(error) def job_attachment_notifier(self, message): try: self.notifier.glowing_messages(message) self.notifier.dismiss_message() return True except Exception as error: ui_logger.error(error) def job_description(self, description): self.wait.web_element_wait_send_keys(By.XPATH, self.__e_description, description, 'Job_description') self.wait.drop_down_selection() return True def job_location(self, location): self.wait.web_element_wait_send_keys(By.XPATH, self.__e_location, location, 'Job_location_field') self.wait.drop_down_selection() return True def job_hiring_manager(self, hm): self.wait.web_element_wait_send_keys(By.XPATH, self.__e_hm, hm, 'job_hm_field') self.wait.drop_down_selection() return True def job_business_unit(self, bu): self.wait.web_element_wait_send_keys(By.XPATH, self.__e_bu, bu, 'Job_bu_field') self.wait.drop_down_selection() return True def job_openings(self, openings): self.wait.clear(By.NAME, self.__e_openings, 'Job_openings_field') self.wait.web_element_wait_send_keys(By.NAME, self.__e_openings, openings, 'Job_openings_field') return True def job_male_diversity(self, male_diversity): self.wait.clear(By.XPATH, self.__e_male, 'Job_male_field') self.wait.web_element_wait_send_keys(By.XPATH, self.__e_male, male_diversity, 'Job_male_field') return True def job_female_diversity(self, female_diversity): self.wait.clear(By.XPATH, self.__e_female, 'Job_female_field') self.wait.web_element_wait_send_keys(By.XPATH, self.__e_female, female_diversity, 'Job_female_field') return True def job_create(self): self.wait.web_element_wait_click(By.XPATH, self.__e_job_create, 'Job_create_button') self.wait.loading() return True def job_create_notifier(self, message): try: self.notifier.glowing_messages(message) return True except Exception as error: ui_logger.error(error) def job_create_notifier_dismiss(self): try: self.notifier.dismiss_message() self.wait.loading() time.sleep(0.2) self.wait.loading() return True except Exception as error: ui_logger.error(error)
class EventUploadCandidate: __e_upload_xpath = Locators.ATTACHMENT['file'] __e_next_button_xpath = Locators.BUTTONS['button'].format('Next') __e_declare_xpath = Locators.CHECKBOX['type'] __e_signature_xpath = Locators.CANDIDATE['upload_signature'] __e_agree_xpath = Locators.BUTTONS['button'].format('I Agree') __e_edit_info_xpath = Locators.TITLE['title'].format('Edit') __e_name_xpath = Locators.CANDIDATE['name_field'] __e_email_xpath = Locators.CANDIDATE['email_field'] __e_usn_xpath = Locators.CANDIDATE['usn_field'] __e_save_button_xpath = Locators.CANDIDATE['save_info'] __e_save_candidate_xpath = Locators.CANDIDATE['save'] __e_upload_count_css = Locators.CANDIDATE['Upload_count'] __e_close_button_xpath = Locators.BUTTONS['button'].format('Close') __e_close_main_xpath = Locators.BUTTONS['close'] __e_confirm_close_main_xpath = Locators.BUTTONS['all_buttons'].format('OK') def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.notifier = Notifier(self.driver) self.scroll = PageScroll(self.driver) def upload_file(self, upload_file): try: self.wait.web_element_wait_send_keys(By.XPATH, self.__e_upload_xpath, upload_file, 'upload_file') print('Candidate excel sheet - Uploading') self.wait.uploading() return True except Exception as error: ui_logger.error(error) def next_button(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_next_button_xpath, 'upload_file') print('Candidate scree next button - Clicked') self.wait.loading() return True except Exception as error: ui_logger.error(error) def declare_check(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_declare_xpath, 'declare_check') print('Declare Check - Clicked') return True except Exception as error: ui_logger.error(error) def signature_entry(self): try: self.wait.web_element_wait_send_keys(By.XPATH, self.__e_signature_xpath, 'VinodKumar', 'signature_entry') print('Signature Entry - Signed') return True except Exception as error: ui_logger.error(error) def agreed_button(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_agree_xpath, 'agreed_button') print('Agreed Button - Clicked') return True except Exception as error: ui_logger.error(error) def edit_excel_information(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_edit_info_xpath, 'edit_excel_information') print('Edit Information button - Clicked') return True except Exception as error: ui_logger.error(error) def name_edit(self, candidate_name): try: self.wait.clear(By.XPATH, self.__e_name_xpath, 'Name_field_clear') self.wait.web_element_wait_send_keys(By.XPATH, self.__e_name_xpath, candidate_name, 'name_edit') print('Name information - Changed') return True except Exception as error: ui_logger.error(error) def email_edit(self, candidate_email): try: self.wait.clear(By.XPATH, self.__e_email_xpath, 'Name_field_clear') self.wait.web_element_wait_send_keys(By.XPATH, self.__e_email_xpath, candidate_email, 'email_edit') print('Email information - Changed') return True except Exception as error: ui_logger.error(error) def usn_edit(self, usn_email): try: self.wait.clear(By.XPATH, self.__e_usn_xpath, 'Name_field_clear') self.wait.web_element_wait_send_keys(By.XPATH, self.__e_usn_xpath, usn_email, 'email_edit') print('Usn information - Changed') return True except Exception as error: ui_logger.error(error) def save_info(self): try: self.scroll.down(0, -50) self.wait.web_element_wait_click(By.XPATH, self.__e_save_button_xpath, 'save_info') print('Save information - Saved') return True except Exception as error: ui_logger.error(error) def save_candidate(self): try: time.sleep(1) self.wait.web_element_wait_click(By.XPATH, self.__e_save_candidate_xpath, 'save_candidate') print('Save Candidate - Saved') return True except Exception as error: ui_logger.error(error) def success_upload(self, message): try: time.sleep(3) self.wait.web_element_wait_text(By.CSS_SELECTOR, self.__e_upload_count_css, 'success_upload') if self.wait.text_value.strip() == message: print(f'Success {self.wait.text_value.strip()} - Count') return True except Exception as error: ui_logger.error(error) def close_candidate_screen(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_close_button_xpath, 'close_candidate_screen') print('Close Candidate Screen - Closed') return True except Exception as error: ui_logger.error(error) def close_main_screen(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_close_main_xpath, 'close_main_screen') print('Close Main Screen - Closed') return True except Exception as error: ui_logger.error(error) def confirm_close_main_screen(self): try: self.wait.web_element_wait_click(By.XPATH, self.__e_confirm_close_main_xpath, 'confirm_close_main_screen') print('Confirm Close Main Screen - Closed') self.wait.loading() return True except Exception as error: ui_logger.error(error)