def click(target_name): target = target_name.lower() if target == 'add widget button': location = locations.Buttons.add_widget helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET, target, 'dashboard')
def success_modal_click(target_name): target = target_name.lower() if target == 'ok button': helpers.click_helper(locations.SuccessModal.Buttons.ok) elif target == 'x button' or target == 'close button': helpers.click_helper(locations.SuccessModal.Buttons.close) else: print(warn.INVALID_CLICK_TARGET)
def company_hierarchy_tab_click(target_name): target = target_name.lower() if target == 'add company button': location = locations.CompanyHierarchyTab.Buttons.add_company helpers.click_helper(location) elif target == 'add company grouping button': location = locations.CompanyHierarchyTab.Buttons.add_company_grouping helpers.click_helper(location) else: print('Invalid target requested.')
def delete_modal_click(target_name): target = target_name.lower() if target == 'ok button': location = locations.DeleteModal.Buttons.ok helpers.click_or_type(location) elif target == 'cancel button': location = locations.DeleteModal.Buttons.cancel helpers.click_helper(location) elif target == 'close button': location = locations.DeleteModal.Buttons.close helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET)
def click_data_entry_set_delete_link(set_name): check = True x = 2 while check: try: label = driver.find_element_by_xpath( locations.data_entry_set_name(x)).text if set_name.lower() == label.lower(): helpers.click_helper(locations.Links.data_entry_set_delete(x)) check = False else: x += 1 except NoSuchElementException: check = False print('Set not found.')
def results_exposure_zone_click(row, zone): xpath = locations.Links.result_row_number(row) x = 1 check = True while check: try: xpath = '{}/td[7]/table/tbody/tr[{}]/td[3]'.format(xpath, x) label = driver.find_element_by_xpath(xpath).text if zone.lower() == label.lower(): check = False helpers.click_helper(xpath) else: x += 1 except NoSuchElementException: check = False print('Exposure zone: {} not found in result row {}.'.format(zone, row))
def set_up_sst_validation(customer=None): if customer: # Select customer validate_document_window_click('customers input', select=customer) check = True x = 1 while check: try: elem = driver.find_element_by_xpath( locations.ValidateDocumentWindow.Inputs. exposure_zone_tax_id_row(x)) elem.send_keys('1') helpers.click_helper( locations.ValidateDocumentWindow.Buttons. exposure_zone_never_expire_row(x)) x += 1 except NoSuchElementException: check = False
def manage_company_fax_emails(target_name, **kwargs): target = target_name.lower() if target == 'fax email input': location = locations.CompanyFaxEmailsTab.Inputs.manage_company_fax_emails_modal_fax_email helpers.click_or_type(location, **kwargs) elif target == 'priority select': location = locations.CompanyFaxEmailsTab.Selects.manage_company_fax_emails_modal_priority helpers.click_or_select(location, **kwargs) elif target == 'bucket select': location = locations.CompanyFaxEmailsTab.Selects.manage_company_fax_emails_modal_bucket helpers.click_or_select(location, **kwargs) elif target == 'save button': location = locations.CompanyFaxEmailsTab.Buttons.manage_company_fax_emails_modal_save helpers.click_helper(location) elif target == 'close button': location = locations.CompanyFaxEmailsTab.Buttons.manage_company_fax_emails_modal_close helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET)
def document_types_tab_click(target_name): target = target_name.lower() if target == 'sales and use tax input': location = locations.DocumentTypesTab.Inputs.sales_and_use_tax_checkbox helpers.click_helper(location) elif target == 'federal withholding input': location = locations.DocumentTypesTab.Inputs.federal_withholding_checkbox helpers.click_helper(location) elif target == 'excise certificates input': location = locations.DocumentTypesTab.Inputs.excise_licenses_checkbox helpers.click_helper(location) elif target == 'vat input': location = locations.DocumentTypesTab.Inputs.vat_checkbox helpers.click_helper(location) elif target == 'excise certificates input': location = locations.DocumentTypesTab.Inputs.excise_certificates_checkbox helpers.click_helper(location) else: print('Invalid target requested.')
def click(target_name): target = target_name.lower() if target == 'united states': helpers.click_helper(locations.Links.united_states) elif target == 'canada': helpers.click_helper(locations.Links.canada) elif target == 'other': helpers.click_helper(locations.Links.other) elif target == 'assign nexus': helpers.click_helper(locations.Buttons.assign_nexus) else: print(warn.INVALID_CLICK_TARGET)
def click(target_name, **kwargs): target = target_name.lower() if target == 'customer number input': location = locations.Inputs.customer_number helpers.click_or_type(location, **kwargs) elif target == 'name input': location = locations.Inputs.name helpers.click_or_type(location, **kwargs) elif target == 'contact name input': location = locations.Inputs.contact_name helpers.click_or_type(location, **kwargs) elif target == 'alternate id input': location = locations.Inputs.alternate_id helpers.click_or_type(location, **kwargs) elif target == 'phone number input': location = locations.Inputs.phone_number helpers.click_or_type(location, **kwargs) elif target == 'fax number input': location = locations.Inputs.fax_number helpers.click_or_type(location, **kwargs) elif target == 'email address input': location = locations.Inputs.email_address helpers.click_or_type(location, **kwargs) elif target == 'fein input': location = locations.Inputs.fein helpers.click_or_type(location, **kwargs) elif target == 'attention name input': location = locations.Inputs.attention_name helpers.click_or_type(location, **kwargs) elif target == 'address line 1 input': location = locations.Inputs.address_line_1 helpers.click_or_type(location, **kwargs) elif target == 'address line 2 input': location = locations.Inputs.address_line_2 helpers.click_or_type(location, **kwargs) elif target == 'city input': location = locations.Inputs.city helpers.click_or_type(location, **kwargs) elif target == 'zip input': location = locations.Inputs.zip helpers.click_or_type(location, **kwargs) elif target == 'state select': location = locations.Selects.state helpers.click_or_select(location, **kwargs) elif target == 'country select': location = locations.Selects.country helpers.click_or_select(location, **kwargs) elif target == 'generate button': location = locations.Buttons.generate helpers.click_helper(location) elif target == 'add new customer button': location = locations.Buttons.add_new_customer helpers.click_helper(location) time.sleep(3) # Wait for processing elif target == 'reset button': location = locations.Buttons.reset helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET)
def upload_document_modal_click(target_name, **kwargs): target = target_name.lower() if target == 'choose file input': location = locations.UploadDocumentModal.Inputs.choose_file helpers.click_or_type(location, **kwargs) elif target == 'claim document input': location = locations.UploadDocumentModal.Inputs.claim_document helpers.click_or_type(location, **kwargs) elif target == 'auto split page count input': location = locations.UploadDocumentModal.Inputs.auto_split_page_count helpers.click_or_type(location, **kwargs) elif target == 'priority select': location = locations.UploadDocumentModal.Selects.priority helpers.click_or_select(location, **kwargs) elif target == 'auto split select': location = locations.UploadDocumentModal.Selects.auto_split helpers.click_or_select(location, **kwargs) elif target == 'bucket select': location = locations.UploadDocumentModal.Selects.bucket helpers.click_or_select(location, **kwargs) elif target == 'document type select': location = locations.UploadDocumentModal.Selects.document_type helpers.click_or_select(location, **kwargs) elif target == 'exposure zone select': location = locations.UploadDocumentModal.Selects.exposure_zone helpers.click_or_select(location, **kwargs) elif target == 'exempt reason select': location = locations.UploadDocumentModal.Selects.exempt_reason helpers.click_or_select(location, **kwargs) elif target == 'close button': location = locations.UploadDocumentModal.Buttons.close helpers.click_helper(location) elif target == 'upload stack button': location = locations.UploadDocumentModal.Buttons.upload_stack_button helpers.click_helper(location) time.sleep(3) else: print(warn.INVALID_CLICK_TARGET)
def retail_location_click(target_name, **kwargs): target = target_name.lower() if target == 'location name input': location = locations.RetailLocation.Inputs.name helpers.click_or_type(location, **kwargs) elif target == 'location codes input': location = locations.RetailLocation.Inputs.location_codes helpers.textarea_field_click_or_type(location, **kwargs) elif target == 'state input': location = locations.RetailLocation.Inputs.state helpers.input_field_click_or_select(location, **kwargs) elif target == 'limit search select': location = locations.RetailLocation.Selects.limit_search helpers.click_or_select(location, **kwargs) elif target == 'state add all button': location = locations.RetailLocation.Buttons.state_add_all helpers.click_helper(location) elif target == 'state remove all button': location = locations.RetailLocation.Buttons.state_remove_all helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET, target)
def tabs_click(target_name): target = target_name.lower() time.sleep(2) if target == 'details': helpers.click_helper(locations.Links.details_tab) elif target == 'company hierarchy': helpers.click_helper(locations.Links.company_hierarchy_tab) elif target == 'document types': helpers.click_helper(locations.Links.document_types_tab) elif target == 'features': helpers.click_helper(locations.Links.features_tab) else: print('Invalid target requested.') time.sleep(2)
def other_edit_client_nexus_modal_click(target_name): target = target_name.lower() if target == 'toggle select all input': helpers.click_helper( locations.Inputs.other_edit_client_nexus_modal_toggle_select_all) elif target == 'close button': helpers.click_helper( locations.Buttons.other_edit_client_nexus_modal_close) elif target == 'cancel button': helpers.click_helper( locations.Buttons.other_edit_client_nexus_modal_cancel) elif target == 'update client nexus button': helpers.click_helper(locations.Buttons. other_edit_client_nexus_modal_update_client_nexus) else: print(warn.INVALID_CLICK_TARGET)
def certificate_attributes_click(target_name, **kwargs): target = target_name.lower() if target == 'certificate has input': location = locations.CertificateAttributes.Inputs.certificate_has helpers.textarea_field_click_or_type(location, **kwargs) elif target == 'certificate does not have input': location = locations.CertificateAttributes.Inputs.certificate_does_not_have helpers.click_or_type(location, **kwargs) elif target == 'certificate attribute added date begin input': location = locations.CertificateAttributes.Inputs.certificate_attribute_added_date_begin helpers.click_or_type(location, **kwargs) elif target == 'certificate attribute added date end input': location = locations.CertificateAttributes.Inputs.certificate_attribute_added_date_end helpers.click_or_type(location, **kwargs) elif target == 'certificate attribute added date ago input': location = locations.CertificateAttributes.Inputs.certificate_attribute_added_date_ago helpers.click_or_type(location, **kwargs) elif target == 'certificate attribute added date to input': location = locations.CertificateAttributes.Inputs.certificate_attribute_added_date_to helpers.click_or_type(location, **kwargs) elif target == 'certificate has select': location = locations.CertificateAttributes.Selects.certificate_has helpers.click_or_select(location, **kwargs) elif target == 'certificate does not have select': location = locations.CertificateAttributes.Selects.certificate_does_not_have helpers.click_or_select(location, **kwargs) elif target == 'attribute added date select': location = locations.CertificateAttributes.Selects.attribute_added_date helpers.click_or_select(location, **kwargs) elif target == 'certificate has add all button': helpers.click_helper( locations.CertificateAttributes.Buttons.certificate_has_add_all) elif target == 'certificate has remove all button': helpers.click_helper( locations.CertificateAttributes.Buttons.certificate_has_remove_all) elif target == 'certificate does not have add all button': helpers.click_helper(locations.CertificateAttributes.Buttons. certificate_does_not_have_add_all) elif target == 'certificate does not have remove all button': helpers.click_helper(locations.CertificateAttributes.Buttons. certificate_does_not_have_remove_all) else: print(warn.INVALID_CLICK_TARGET, target)
def customer_attributes_click(target_name, **kwargs): target = target_name.lower() if target == 'customer has attributes input': location = locations.CustomerAttributes.Inputs.customer_has helpers.input_field_click_or_select(location, **kwargs) elif target == 'customer does not have attributes input': location = locations.CustomerAttributes.Inputs.customer_does_not_have helpers.input_field_click_or_select(location, **kwargs) elif target == 'attribute added date start input': location = locations.CustomerAttributes.Inputs.customer_attributes_date_begin helpers.input_field_click_or_select(location, **kwargs) elif target == 'attribute added date end input': location = locations.CustomerAttributes.Inputs.customer_attributes_date_end helpers.input_field_click_or_select(location, **kwargs) elif target == 'attribute added date ago input': location = locations.CustomerAttributes.Inputs.customer_attributes_days_ago helpers.input_field_click_or_select(location, **kwargs) elif target == 'attribute added date to input': location = locations.CustomerAttributes.Inputs.customer_attributes_days_to helpers.input_field_click_or_select(location, **kwargs) elif target == 'customer has attributes select': location = locations.CustomerAttributes.Selects.customer_has helpers.click_or_select(location, **kwargs) elif target == 'customer does not have attributes select': location = locations.CustomerAttributes.Selects.customer_does_not_have helpers.click_or_select(location, **kwargs) elif target == 'attribute added date select': location = locations.CustomerAttributes.Selects.attribute_added_date helpers.click_or_select(location, **kwargs) elif target == 'customer has add all button': helpers.click_helper( locations.CustomerAttributes.Buttons.customer_has_add_all) elif target == 'customer has remove all button': helpers.click_helper( locations.CustomerAttributes.Buttons.customer_has_remove_all) elif target == 'customer does not have add all button': helpers.click_helper(locations.CustomerAttributes.Buttons. customer_does_not_have_add_all) elif target == 'customer does not have remove all button': helpers.click_helper(locations.CustomerAttributes.Buttons. customer_does_not_have_remove_all) else: print(warn.INVALID_CLICK_TARGET, target)
def certificate_invalid_reasons_click(target_name, **kwargs): target = target_name.lower() if target == 'certificate has invalid reasons input': location = locations.CertificateInvalidReasons.Inputs.certificate_has_invalid_reasons helpers.input_field_click_or_select(location, **kwargs) elif target == 'certificate does not have invalid reasons input': location = locations.CertificateInvalidReasons.Inputs.certificate_does_not_have_invalid_reasons helpers.input_field_click_or_select(location, **kwargs) elif target == 'certificate invalid reasons date begin input': location = locations.CertificateInvalidReasons.Inputs.certificate_invalid_reasons_date_begin helpers.input_field_click_or_select(location, **kwargs) elif target == 'certificate invalid reasons date end input': location = locations.CertificateInvalidReasons.Inputs.certificate_invalid_reasons_date_end helpers.input_field_click_or_select(location, **kwargs) elif target == 'certificate invalid reasons date ago input': location = locations.CertificateInvalidReasons.Inputs.certificate_invalid_reasons_days_ago helpers.input_field_click_or_select(location, **kwargs) elif target == 'certificate invalid reasons date to input': location = locations.CertificateInvalidReasons.Inputs.certificate_invalid_reasons_days_to helpers.input_field_click_or_select(location, **kwargs) elif target == 'certificate has invalid reasons select': location = locations.CertificateInvalidReasons.Selects.certificate_has_invalid_reasons helpers.click_or_select(location, **kwargs) elif target == 'certificate does not have invalid reasons select': location = locations.CertificateInvalidReasons.Selects.certificate_does_not_have_invalid_reasons helpers.click_or_select(location, **kwargs) elif target == 'reason added date select': location = locations.CertificateInvalidReasons.Selects.reason_added_date helpers.click_or_select(location, **kwargs) elif target == 'certificate has invalid reasons add all button': location = locations.CertificateInvalidReasons.Buttons.certificate_has_invalid_reasons_add_all helpers.click_helper(location) elif target == 'certificate has invalid reasons remove all button': location = locations.CertificateInvalidReasons.Buttons.certificate_has_invalid_reasons_remove_all helpers.click_helper(location) elif target == 'certificate does not have invalid reasons add all button': location = locations.CertificateInvalidReasons.Buttons.certificate_does_not_have_invalid_reasons_add_all helpers.click_helper(location) elif target == 'certificate does not have invalid reasons remove all button': location = locations.CertificateInvalidReasons.Buttons.certificate_does_not_have_invalid_reasons_remove_all helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET, target)
def provision_avatax_account_modal_click(target_name, **kwargs): target = target_name.lower() if target == 'avatax account id input': location = locations.Inputs.provision_avatax_account_modal_avatax_account_id helpers.click_or_type(location, **kwargs) elif target == 'import ecms data checkbox input': location = locations.Inputs.provision_avatax_account_modal_import_ecms_data_checkbox helpers.click_helper(location) elif target == 'provision avatax account button': location = locations.Buttons.provision_avatax_account_modal_provision_avatax_account helpers.click_helper(location) elif target == 'cancel button': location = locations.Buttons.provision_avatax_account_modal_cancel helpers.click_helper(location) elif target == 'x button' or target == 'close button': location = locations.Buttons.provision_avatax_account_modal_close helpers.click_helper(location) else: print('Invalid click target requested')
def edit_customer_details_modal_click(target_name): # Add input fields? target = target_name.lower() if target == 'close button': location = locations.EditCustomerDetailsModal.Buttons.close helpers.click_helper(location) elif target == 'finish button': location = locations.EditCustomerDetailsModal.Buttons.finish helpers.click_helper(location) elif target == 'cancel button': location = locations.EditCustomerDetailsModal.Buttons.cancel helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET)
def click(target_name): target = target_name.lower() if target == 'choose file input': return helpers.click_helper(locations.Inputs.choose_file) elif target == 'upload button': return helpers.click_helper(locations.Buttons.upload) elif target == 'import customer data button': return helpers.click_helper(locations.Buttons.import_customer_data) elif target == 'success modal ok button': # Not working for some reason? Other seem to work fine. return helpers.click_helper(locations.Buttons.success_modal_ok) elif target == 'success modal close button': return helpers.click_helper(locations.Buttons.success_modal_close) elif target == 'error modal ok button': return helpers.click_helper(locations.Buttons.error_modal_ok) elif target == 'error modal close button': return helpers.click_helper(locations.Buttons.error_modal_close) else: print(warn.INVALID_CLICK_TARGET)
def add_company_modal_click(target_name, **kwargs): target = target_name.lower() if target == 'display name input': location = locations.CompanyHierarchyTab.Inputs.add_company_modal_display_name helpers.click_or_type(location, **kwargs) elif target == 'legal name input': location = locations.CompanyHierarchyTab.Inputs.add_company_modal_legal_name helpers.click_or_type(location, **kwargs) elif target == 'use address input': location = locations.CompanyHierarchyTab.Inputs.add_company_modal_use_address_checkbox helpers.click_or_type(location, **kwargs) elif target == 'address line 1 input': location = locations.CompanyHierarchyTab.Inputs.add_company_modal_address_line_1 helpers.click_or_type(location, **kwargs) elif target == 'address line 2 input': location = locations.CompanyHierarchyTab.Inputs.add_company_modal_address_line_2 helpers.click_or_type(location, **kwargs) elif target == 'city input': location = locations.CompanyHierarchyTab.Inputs.add_company_modal_city helpers.click_or_type(location, **kwargs) elif target == 'country select': location = locations.CompanyHierarchyTab.Selects.add_company_modal_country helpers.click_or_select(location, **kwargs) elif target == 'state/province select': location = locations.CompanyHierarchyTab.Selects.add_company_modal_state helpers.click_or_select(location, **kwargs) elif target == 'zip input': location = locations.CompanyHierarchyTab.Inputs.add_company_modal_zip helpers.click_or_type(location, **kwargs) elif target == 'phone input': location = locations.CompanyHierarchyTab.Inputs.add_company_modal_phone helpers.click_or_type(location, **kwargs) elif target == 'fein input': location = locations.CompanyHierarchyTab.Inputs.add_company_modal_fein helpers.click_or_type(location, **kwargs) elif target == 'add button': location = locations.CompanyHierarchyTab.Buttons.add_company_modal_add helpers.click_helper(location) elif target == 'cancel button': location = locations.CompanyHierarchyTab.Buttons.add_company_modal_cancel helpers.click_helper(location) elif target == 'close button': location = locations.CompanyHierarchyTab.Buttons.add_company_modal_close helpers.click_helper(location) else: print('Invalid target requested.')
def edit_data_entry_set_modal_click(target_name, **kwargs): target = target_name.lower() if target == 'name input': location = locations.EditDataEntrySetModal.Inputs.name helpers.click_or_type(location, **kwargs) elif target == 'update button': location = locations.EditDataEntrySetModal.Buttons.update helpers.click_helper(location) elif target == 'cancel button': location = locations.EditDataEntrySetModal.Buttons.cancel helpers.click_helper(location) elif target == 'close button': location = locations.EditDataEntrySetModal.Buttons.close helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET)
def add_company_grouping_modal_click(target_name, **kwargs): target = target_name.lower() if target == 'name input': location = locations.CompanyHierarchyTab.Inputs.add_company_grouping_modal_name helpers.click_or_type(location, **kwargs) elif target == 'add button': location = locations.CompanyHierarchyTab.Buttons.add_company_grouping_modal_add helpers.click_helper(location) elif target == 'cancel button': location = locations.CompanyHierarchyTab.Buttons.add_company_grouping_modal_cancel helpers.click_helper(location) elif target == 'close button': location = locations.CompanyHierarchyTab.Buttons.add_company_grouping_modal_close helpers.click_helper(location) else: print('Invalid target requested.')
def create_new_customer_and_certificate_click(target_name, **kwargs): target = target_name.lower() if target == 'name of business input': location = locations.CreateNewCustomerAndDocumentModal.Inputs.name_of_business helpers.click_or_type(location, **kwargs) elif target == 'contact email input': location = locations.CreateNewCustomerAndDocumentModal.Inputs.contact_email helpers.click_or_type(location, **kwargs) elif target == 'business phone input': location = locations.CreateNewCustomerAndDocumentModal.Inputs.business_phone helpers.click_or_type(location, **kwargs) elif target == 'address line 1 input': location = locations.CreateNewCustomerAndDocumentModal.Inputs.address_line_1 helpers.click_or_type(location, **kwargs) elif target == 'address line 2 input': location = locations.CreateNewCustomerAndDocumentModal.Inputs.address_line_2 helpers.click_or_type(location, **kwargs) elif target == 'business city input': location = locations.CreateNewCustomerAndDocumentModal.Inputs.business_city helpers.click_or_type(location, **kwargs) elif target == 'business zip code input': location = locations.CreateNewCustomerAndDocumentModal.Inputs.business_zip_code helpers.click_or_type(location, **kwargs) elif target == 'contact name input': location = locations.CreateNewCustomerAndDocumentModal.Inputs.contact_name helpers.click_or_type(location, **kwargs) elif target == 'business country select': location = locations.CreateNewCustomerAndDocumentModal.Selects.business_country helpers.click_or_select(location, **kwargs) elif target == 'business state select': location = locations.CreateNewCustomerAndDocumentModal.Selects.business_state helpers.click_or_select(location, **kwargs) elif target == 'close button': location = locations.CreateNewCustomerAndDocumentModal.Buttons.close helpers.click_helper(location) elif target == 'next button': location = locations.CreateNewCustomerAndDocumentModal.Buttons.next helpers.click_helper(location) elif target == 'cancel button': location = locations.CreateNewCustomerAndDocumentModal.Buttons.cancel helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET)
def exemption_search_modal_click(target_name, **kwargs): target = target_name.lower() if target == 'customer name input': location = locations.ExemptionSearchModal.Inputs.customer_name helpers.click_or_type(location, **kwargs) elif target == 'phone number input': location = locations.ExemptionSearchModal.Inputs.phone_number helpers.click_or_type(location, **kwargs) elif target == 'email input': location = locations.ExemptionSearchModal.Inputs.email helpers.click_or_type(location, **kwargs) elif target == 'city input': location = locations.ExemptionSearchModal.Inputs.city helpers.click_or_type(location, **kwargs) elif target == 'zip code input': location = locations.ExemptionSearchModal.Inputs.zip_code helpers.click_or_type(location, **kwargs) elif target == 'customer number input': location = locations.ExemptionSearchModal.Inputs.customer_number helpers.click_or_type(location, **kwargs) elif target == 'document id input': location = locations.ExemptionSearchModal.Inputs.document_id helpers.click_or_type(location, **kwargs) elif target == 'customer state select': location = locations.ExemptionSearchModal.Selects.customer_state helpers.click_or_select(location, **kwargs) elif target == 'document zone select': location = locations.ExemptionSearchModal.Selects.document_zone helpers.click_or_select(location, **kwargs) elif target == 'close button': location = locations.ExemptionSearchModal.Buttons.close helpers.click_helper(location) elif target == 'search button': location = locations.ExemptionSearchModal.Buttons.search helpers.click_helper(location) elif target == 'clear screen button': location = locations.ExemptionSearchModal.Buttons.clear_screen helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET)
def edit_campaign_click(target_name, **kwargs): """ :rtype: object """ target = target_name.lower() if target == 'send date input': location = locations.EditCampaign.Inputs.send_date helpers.click_or_type_date(location, **kwargs) elif target == 'requested return date input': location = locations.EditCampaign.Inputs.requested_return_date # Clear field if date is auto-generated; Maybe this should be in a helper? driver.find_element_by_xpath(location).clear() helpers.click_or_type_date(location, **kwargs) elif target == 'generate date input': location = locations.EditCampaign.Inputs.generate_date helpers.click_or_type_date(location, **kwargs) elif target == 'include most recent invalid input': location = locations.EditCampaign.Inputs.include_most_recent helpers.click_or_type(location, **kwargs) elif target == 'cover letter only input': location = locations.EditCampaign.Inputs.cover_letter_only helpers.click_or_type(location, **kwargs) elif target == 'include certexpress access input': location = locations.EditCampaign.Inputs.include_certexpress_access helpers.click_or_type(location, **kwargs) elif target == 'automatically send round input': location = locations.EditCampaign.Inputs.automatically_send_round helpers.click_or_type(location, **kwargs) elif target == 'notes input': location = locations.EditCampaign.Inputs.notes helpers.click_or_type(location, **kwargs) elif target == 'method select': location = locations.EditCampaign.Selects.method helpers.click_or_select(location, **kwargs) elif target == 'email template cover letter select': location = locations.EditCampaign.Selects.email_template_cover_letter helpers.click_or_select(location, **kwargs) elif target == 'overview link': helpers.click_helper(locations.EditCampaign.Links.overview) elif target == 'add round link': helpers.click_helper(locations.EditCampaign.Links.add_round) elif target == 'scheduling and delivery link': helpers.click_helper( locations.EditCampaign.Links.scheduling_and_delivery) elif target == 'select customers link': helpers.click_helper(locations.EditCampaign.Links.select_customers) elif target == 'preview link': helpers.click_helper(locations.EditCampaign.Links.preview) elif target == 'print link': helpers.click_helper(locations.EditCampaign.Links.print) elif target == 'send emails link': helpers.click_helper(locations.EditCampaign.Links.send_emails) elif target == 'clone round link': helpers.click_helper(locations.EditCampaign.Links.clone_round) elif target == 'delete round link': helpers.click_helper(locations.EditCampaign.Links.delete_round) elif target == 'customer number header link': helpers.click_helper( locations.EditCampaign.Links.customer_number_header) elif target == 'name header link': helpers.click_helper(locations.EditCampaign.Links.name_header) elif target[0:5] == 'round' and target[-4:] == 'link': if target[7] == ' ': number = target[6] # Supports single digits helpers.click_helper(locations.EditCampaign.Links.round(number)) elif target[8] == ' ': number = target[6:8] # Supports double digits helpers.click_helper(locations.EditCampaign.Links.round(number)) else: print(warn.SOME_PROBLEM) elif target == 'delete campaign button': helpers.click_helper(locations.EditCampaign.Buttons.delete_campaign) elif target == 'save campaign changes button': helpers.click_helper( locations.EditCampaign.Buttons.save_campaign_changes) time.sleep(2) elif target == 'send compliance document requests button': driver.find_element_by_xpath( locations.EditCampaign.Buttons.send_compliance_document_requests ).click() time.sleep(2) Alert(driver).accept() elif target == 'export overview data button': helpers.click_helper( locations.EditCampaign.Buttons.export_overview_data) elif target == 'first button': helpers.click_helper(locations.EditCampaign.Buttons.first) elif target == 'prev button': helpers.click_helper(locations.EditCampaign.Buttons.prev) elif target == 'page selector select': location = locations.EditCampaign.Selects.page_selector helpers.click_or_select(location, **kwargs) elif target == 'next button': helpers.click_helper(locations.EditCampaign.Buttons.next) elif target == 'last button': helpers.click_helper(locations.EditCampaign.Buttons.last) elif target == 'pdf - 1 merged file input': helpers.click_helper(locations.EditCampaign.Inputs.merged_file) elif target == 'zip - individual pdfs input': helpers.click_helper(locations.EditCampaign.Inputs.zip_individual) elif target == 'zip - merged pdf by page count input': helpers.click_helper(locations.EditCampaign.Inputs.zip_merged) elif target == 'create printable file button': helpers.click_helper( locations.EditCampaign.Buttons.create_printable_file) else: print(warn.INVALID_CLICK_TARGET)
def set_up_campaign_click(target_name, **kwargs): target = target_name.lower() if target == 'campaign title input': location = locations.SetUpCampaign.Inputs.campaign_title helpers.click_or_type(location, **kwargs) elif target == 'include customers input': return helpers.click_helper( locations.SetUpCampaign.Inputs.include_customers) elif target == 'omit customers input': return helpers.click_helper( locations.SetUpCampaign.Inputs.omit_customers) elif target == 'missing exemption input': return helpers.click_helper( locations.SetUpCampaign.Inputs.missing_exemption) elif target == 'invalid exemption input': return helpers.click_helper( locations.SetUpCampaign.Inputs.invalid_exemption) elif target == 'expired certificate input': return helpers.click_helper( locations.SetUpCampaign.Inputs.expired_certificate) elif target == 'include soon to expire input': return helpers.click_helper( locations.SetUpCampaign.Inputs.include_soon_to_expire) elif target == 'include soon to expire days input': return helpers.click_helper( locations.SetUpCampaign.Inputs.include_soon_to_expire_days) elif target == 'taxable exposures input': return helpers.click_helper( locations.SetUpCampaign.Inputs.taxable_exposures) elif target == 'override input': return helpers.click_helper(locations.SetUpCampaign.Inputs.override) elif target == 'billing customers input': return helpers.click_helper( locations.SetUpCampaign.Inputs.billing_customers) elif target == 'shipping customers input': return helpers.click_helper( locations.SetUpCampaign.Inputs.shipping_customers) elif target == 'exclude same as input': return helpers.click_helper( locations.SetUpCampaign.Inputs.exclude_same_as) elif target == 'expand bill to ship input': return helpers.click_helper( locations.SetUpCampaign.Inputs.expand_bill_to_ship) elif target == 'exempt reasons input': location = locations.SetUpCampaign.Inputs.exempt_reasons helpers.input_field_click_or_select(location, **kwargs) elif target == 'select all link': return helpers.click_helper(locations.SetUpCampaign.Links.select_all) elif target == 'deselect all link': return helpers.click_helper(locations.SetUpCampaign.Links.deselect_all) elif target == 'document type select': location = locations.SetUpCampaign.Selects.document_type helpers.click_or_select(location, **kwargs) elif target == 'prepare campaign button': # Attempting to return this element causes an error # driver.find_element_by_xpath(locations.SetUpCampaign.Buttons.prepare_campaign).click() location = locations.SetUpCampaign.Buttons.prepare_campaign helpers.click_helper(location) time.sleep(2) else: print(warn.INVALID_CLICK_TARGET)
def click(target_name): target = target_name.lower() if target == 'add data entry set button': location = locations.Buttons.add_data_entry_set helpers.click_helper(location) elif target == 'name header link': location = locations.Links.name_header helpers.click_helper(location) elif target[0:3] == 'row' and target[-9:] == 'edit link': if target[5] == ' ': number = target[4] # Supports single digits helpers.click_helper(locations.Links.data_entry_set_edit(number)) elif target[6] == ' ': number = target[4:5] # Supports double digits helpers.click_helper(locations.Links.data_entry_set_edit(number)) else: print(warn.SOME_PROBLEM) elif target[0:3] == 'row' and target[-11:] == 'delete link': if target[5] == ' ': number = target[4] # Supports single digits helpers.click_helper(locations.Links.data_entry_set_edit(number)) elif target[6] == ' ': number = target[4:5] # Supports double digits helpers.click_helper(locations.Links.data_entry_set_edit(number)) else: print(warn.SOME_PROBLEM) else: print(warn.INVALID_CLICK_TARGET)
def download_center_click(target_name): target = target_name.lower() if target == 'minimize button': location = locations.DownloadCenter.Buttons.minimize helpers.click_helper(location) elif target == 'maximize button': location = locations.DownloadCenter.Buttons.maximize helpers.click_helper(location) elif target == 'close button': location = locations.DownloadCenter.Buttons.close helpers.click_helper(location) elif target == 'prev button': location = locations.DownloadCenter.Buttons.prev helpers.click_helper(location) elif target == 'next button': location = locations.DownloadCenter.Buttons.next helpers.click_helper(location) elif target == 'date header link': location = locations.DownloadCenter.Links.created_header helpers.click_helper(location) elif target == 'refresh link': location = locations.DownloadCenter.Links.refresh helpers.click_helper(location) elif target == 'full report link': location = locations.DownloadCenter.Links.full_report helpers.click_helper(location) elif target[0:12] == 'download row' and target[-4:] == 'link': if target[14] == ' ': row = target[13] elif target[15] == ' ': row = target[13:15] else: row = '0' print(warn.SOME_PROBLEM) location = locations.DownloadCenter.Links.download_link_row(row) helpers.click_helper(location) else: print(warn.INVALID_CLICK_TARGET, target, 'dashboard - download center')