コード例 #1
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_certificate_validation(exposure_zone, exempt_reason, effective_date,
                                  customer_number):
    result_exposure_zone = driver.find_element_by_xpath(
        '//table[@id="search_results_grid"]/tbody/tr[2]/td[2]').text
    result_exempt_reason = driver.find_element_by_xpath(
        '//table[@id="search_results_grid"]/tbody/tr[2]/td[3]').text
    result_effective_date = driver.find_element_by_xpath(
        '//table[@id="search_results_grid"]/tbody/tr[2]/td[4]').text
    result_customer_number = driver\
        .find_element_by_xpath('//table[@id="search_results_grid"]/tbody/tr[2]/td[7]/table/tbody/tr[2]/td[3]').text

    assert result_exposure_zone.lower() == exposure_zone.lower(), 'Incorrect exposure zone. Expected: {}, Found {}.'\
        .format(exposure_zone.lower(), result_exposure_zone)
    assert result_exempt_reason.lower() == exempt_reason.lower(), 'Incorrect exempt reason. Expected: {}, Found {}.'\
        .format(exempt_reason, result_exempt_reason)
    assert result_effective_date == effective_date, 'Incorrect effective date. Expected: {}, Found {}.'\
        .format(effective_date, result_effective_date)
    assert result_customer_number == customer_number, 'Incorrect customer number. Expected: {}, Found {}.'\
        .format(customer_number, result_customer_number)
    print('Certificate validated successfully...')

    certificate_id = driver.find_element_by_xpath(
        '//table[@id="search_results_grid"]/tbody/tr[2]/td[1]/a').text

    print('Certificate ID: {}'.format(certificate_id))
コード例 #2
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_document_upload(filename,
                           exposure_zone=None,
                           stage='Ready For Merge',
                           source='Upload',
                           age='0'):
    validation_screen_filename = driver.find_element_by_xpath(
        '//*[@id="DataEntrySearch"]/tbody/tr[2]/td[4]').text
    validation_screen_stage = driver.find_element_by_xpath(
        '//*[@id="DataEntrySearch"]/tbody/tr[2]/td[6]').text
    validation_screen_exposure_zone = driver.find_element_by_xpath(
        '//*[@id="DataEntrySearch"]/tbody/tr[2]/td[9]').text
    validation_screen_source = driver.find_element_by_xpath(
        '//*[@id="DataEntrySearch"]/tbody/tr[2]/td[10]').text
    validation_screen_age = driver.find_element_by_xpath(
        '//*[@id="DataEntrySearch"]/tbody/tr[2]/td[13]').text

    assert validation_screen_filename.lower() == filename.lower(), 'Incorrect filename. Expected: {}, Found {}.'\
        .format(filename, validation_screen_filename)

    assert validation_screen_stage.lower() == stage.lower(), 'Incorrect stage. Expected: {}, Found {}.'\
        .format(stage, validation_screen_stage)

    assert validation_screen_exposure_zone.lower() == exposure_zone.lower(), \
        'Incorrect exposure zone. Expected: {}, Found {}.'.format(exposure_zone, validation_screen_exposure_zone)

    assert validation_screen_source.lower() == source.lower(), 'Incorrect source. Expected: {}, Found {}.'\
        .format(source, validation_screen_source)

    assert validation_screen_age == age

    print('Certificate uploaded successfully...')
コード例 #3
0
ファイル: actions.py プロジェクト: hartleyn/sel-cc
def cc_login_from_arguments():
    user = args.username
    password = args.password

    try:
        WebDriverWait(driver, 10).until(
            expected_conditions.visibility_of_element_located((By.XPATH, locations.Inputs.user))
        )
        email = driver.find_element_by_xpath(locations.Inputs.user)
        email.clear()
        email.send_keys(user)
        email.send_keys(Keys.RETURN)
    except TimeoutException:
        print(warn.TIMEOUT, 'Process: Entering username.')

    try:
        WebDriverWait(driver, 10).until(
            expected_conditions.visibility_of_element_located((By.XPATH, locations.Inputs.password))
        )
        pass_field = driver.find_element_by_xpath(locations.Inputs.password)
        pass_field.clear()
        pass_field.send_keys(password)
        pass_field.send_keys(Keys.RETURN)
        # Automatically pause for 7 seconds after login
        time.sleep(7)
    except TimeoutException:
        print(warn.TIMEOUT, 'Process: Entering password.')
コード例 #4
0
def select_exempt_reasons(reasons):
    if debug:
        print('Selecting reasons')

    # Cast argument to a list if one wasn't passed in
    if type(reasons) is not list:
        reasons = [reasons]

    for reason in reasons:
        if debug:
            print('clicking exempt reason input, searching for {}'.format(
                reason))
            time.sleep(2)
        click('exempt reason input')

        x = 1
        check = True

        while check:
            try:
                if reason.upper() == driver.find_element_by_xpath(
                        '//*[@id="tax_code_id_chosen"]'
                        '/div/ul/li[{}]'.format(x)).text:
                    time.sleep(2)
                    driver.find_element_by_xpath(
                        '//*[@id="tax_code_id_chosen"]/div/ul/li[{}]'.format(
                            x)).click()
                    check = False
                else:
                    x += 1
            except NoSuchElementException:
                print('Unable to locate exempt reason.')
                check = False
コード例 #5
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_all_states_assigned():
    if debug:
        print('Checking exposure zone assignments.')
    time.sleep(2)

    for col in range(1, 5):
        for row in range(1, 15):
            if debug:
                zone = driver.find_element_by_xpath(
                    '//*[@id="accordion"]/div/div[2]/table/tbody'
                    '/tr/td[{}]/table/tbody/tr[{}]/td[2]/p'.format(col,
                                                                   row)).text
                if debug:
                    print('Checking: {}'.format(zone))
            try:
                driver.find_element_by_xpath(
                    '//*[@id="accordion"]/div/div[2]/table/tbody'
                    '/tr/td[{}]/table/tbody/tr[{}]/td[2]/p/span'.format(
                        col, row))
                if debug:
                    print('    Assigned')
            except NoSuchElementException:
                zone = driver.find_element_by_xpath(
                    '//*[@id="accordion"]/div/div[2]/table/tbody'
                    '/tr/td[{}]/table/tbody/tr[{}]/td[2]/p'.format(col,
                                                                   row)).text
                assert False, '{} is unassigned.'.format(zone)
    print('All exposure zones assigned in nexus.')
    assert True
コード例 #6
0
ファイル: actions.py プロジェクト: hartleyn/sel-cc
def delete_customers_from_file(filename):
    filepath = '{0}{1}test_assets{1}{2}'.format(os.getcwd(), slash, filename)
    print('file:', filepath)
    driver.find_element_by_xpath(locations.Inputs.choose_file).send_keys(filepath)

    click('upload button')
    # time.sleep(2)
    click('delete customer data button')
    time.sleep(2)
    driver.find_element_by_xpath(locations.Buttons.success_modal_ok).click()
コード例 #7
0
def change_account(account):
    driver.find_element_by_id('dropdownCompanyButton').click()
    time.sleep(3)

    comp_input = driver.find_element_by_id('companyInput')
    comp_input.send_keys(account)
    time.sleep(2)
    # comp_input.send_keys(Keys.RETURN)
    driver.find_element_by_xpath('//*[@id="company-drop"]').click()
    time.sleep(5)
コード例 #8
0
def change_company(company):
    driver.find_element_by_id('dropdownDivisionButton').click()
    time.sleep(3)

    div_input = driver.find_element_by_id('divisionInput')
    div_input.send_keys(company)
    time.sleep(2)
    # div_input.send_keys(Keys.RETURN)
    driver.find_element_by_xpath('//*[@id="division-drop"]').click()
    time.sleep(5)
コード例 #9
0
ファイル: actions.py プロジェクト: hartleyn/sel-cc
def set_up_document_upload(filepath, doc_type, zone, reason):
    # Select upload file
    driver.find_element_by_xpath(
        locations.UploadDocumentModal.Inputs.choose_file).send_keys(filepath)

    # Set 'Document Type'
    upload_document_modal_click('document type select', select=doc_type)

    # Set 'Exposure Zone'
    upload_document_modal_click('exposure zone select', select=zone)

    # Set 'Exempt Reason'
    upload_document_modal_click('exempt reason select', select=reason.upper())
コード例 #10
0
def change_document_type(doc_type):
    doc_type = doc_type.title()

    if doc_type == 'Sales And Use Tax':
        doc_type = 'Sales and Use Tax'
    elif doc_type == 'Vat':
        doc_type = 'VAT'

    driver.find_element_by_xpath(locations.Buttons.doc_type_button).click()
    time.sleep(2)

    driver.find_element_by_link_text(doc_type).click()
    time.sleep(2)
コード例 #11
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_multi_zone_certificate(zones):
    screen_zones = []

    check = True
    x = 2  # Values start in tr[2]
    while check:
        try:
            screen_zone = driver.find_element_by_xpath(
                '//*[@id="search_results_grid"]/tbody/tr[2]/td[6]/table/tbody/tr[{}]/td[2]'
                .format(x)).text

            screen_zones.append(screen_zone)
            x += 1
        except NoSuchElementException:
            check = False

    assert len(screen_zones) == len(zones), \
        'Incorrect number of exposure zones found. Expected: {}. Found {}.'.format(len(zones), len(screen_zones))
    print('Found {} exposure zones.'.format(len(screen_zones)))

    # Check each zone on the screen matches with an expected zone
    for screen_zone in screen_zones:
        assert any(
            screen_zone == zone
            for zone in zones), 'Unexpected exposure zone found: {}'.format(
                screen_zone)
        print('Found expected exposure zone: {}'.format(screen_zone))
コード例 #12
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_data_entry_set(zones):
    time.sleep(3)  # Wait for data entry set exposure zone population

    screen_zones = []

    check = True
    x = 2  # Values start in tr[2]
    while check:
        try:
            screen_zone = driver.find_element_by_xpath(
                '//*[@id="dataEntryForm"]/div[3]/div[1]/div[13]/div/table/tbody/tr[{}]/td[1]'
                .format(x)).text

            screen_zones.append(screen_zone)
            x += 1
        except NoSuchElementException:
            check = False

    assert len(screen_zones) == len(zones), \
        'Incorrect number of exposure zones found. Expected: {}. Found {}.'.format(len(zones), len(screen_zones))
    print('Found {} exposure zones.'.format(len(screen_zones)))

    # Check each zone on the screen matches with an expected zone
    for screen_zone in screen_zones:
        assert any(
            screen_zone == zone
            for zone in zones), 'Unexpected exposure zone found: {}'.format(
                screen_zone)
        print('Found expected exposure zone: {}'.format(screen_zone))
コード例 #13
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_certexpress_certificate_validation(exposure_zone, exempt_reason):
    result_exposure_zone = driver.find_element_by_xpath(
        '//table[@id="search_results_grid"]/tbody/tr[2]/td[2]').text
    result_exempt_reason = driver.find_element_by_xpath(
        '//table[@id="search_results_grid"]/tbody/tr[2]/td[3]').text

    assert result_exposure_zone.lower() == exposure_zone.lower(), 'Incorrect exposure zone. Expected: {}, Found {}.'\
        .format(exposure_zone, result_exposure_zone)
    assert result_exempt_reason.lower() == exempt_reason.lower(), 'Incorrect exempt reason. Expected: {}, Found {}.'\
        .format(exempt_reason, result_exempt_reason)
    print('CertExpress certificate validated successfully...')

    certificate_id = driver.find_element_by_xpath(
        '//table[@id="search_results_grid"]/tbody/tr[2]/td[1]/a').text

    print('Certificate ID: {}'.format(certificate_id))
コード例 #14
0
def store_public_certexpress_link_in_json():
    link = driver.find_element_by_xpath(
        locations.Links.public_certexpress_url).text
    print('Found Public CertExpress link:', link)

    data = {'url': link}

    with open('public_certexpress{}request.json'.format(slash), 'w') as f:
        json.dump(data, f)
コード例 #15
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_account_exists(account_name):
    actions.click('account / database name input', text=account_name)

    actions.click('filter button')

    time.sleep(2)
    result_account_name = driver.find_element_by_xpath(
        '//*[@id="31549"]/td[3]').text

    assert account_name.lower() == result_account_name.lower()
コード例 #16
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_certificate_escalation():
    validation_screen_stage = driver.find_element_by_xpath(
        '//table[@id="DataEntrySearch"]/tbody/tr[2]/td[6]').text

    stage = 'Ready For Validation (Escalated 0 days ago)'

    assert validation_screen_stage.lower() == stage.lower(), 'Incorrect stage. Expected: {}, Found {}.'\
        .format(stage, validation_screen_stage)

    print('Certificate escalated successfully...')
コード例 #17
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_certexpress_certificate_creation(customer):
    validation_screen_customer_number = driver.\
        find_element_by_xpath('//table[@id="DataEntrySearch"]/tbody/tr[2]/td[5]').text
    validation_screen_days = driver.find_element_by_xpath(
        '//table[@id="DataEntrySearch"]/tbody/tr[2]/td[13]').text

    assert validation_screen_customer_number == customer, 'Incorrect customer number. Expected: {}, Found {}.'\
        .format(customer, validation_screen_customer_number)
    assert int(validation_screen_days) == 0, 'Incorrect day count. Expected: {}, Found {}.'\
        .format(0, validation_screen_days)  # Certificate was created 0 days ago
    print('CertExpress certificate created successfully...')
コード例 #18
0
ファイル: actions.py プロジェクト: hartleyn/sel-cc
def cc_login_from_credentials_json(name):
    # Creating a dictionary with parameters from cc_credentials.json
    with open('test_assets{}cc_credentials.json'.format(slash), 'r') as lines:
        obj = json.load(lines)

    name = name.title()

    try:
        user = obj['users'][name]['username']
        password = obj['users'][name]['password']

        print('Credentials found...\n')

        print('Attempting CertCapture login as', str(name) + '...\n')

        try:
            WebDriverWait(driver, 10).until(
                expected_conditions.visibility_of_element_located((By.XPATH, locations.Inputs.user))
            )
            email = driver.find_element_by_xpath(locations.Inputs.user)
            email.clear()
            email.send_keys(user)
            email.send_keys(Keys.RETURN)
        except TimeoutException:
            print(warn.TIMEOUT, 'Process: Entering username.')

        try:
            WebDriverWait(driver, 10).until(
                expected_conditions.visibility_of_element_located((By.XPATH, locations.Inputs.password))
            )
            pass_field = driver.find_element_by_xpath(locations.Inputs.password)
            pass_field.clear()
            pass_field.send_keys(password)
            pass_field.send_keys(Keys.RETURN)
            # Automatically pause for 7 seconds after login
            time.sleep(7)
        except TimeoutException:
            print(warn.TIMEOUT, 'Process: Entering password.')

    except KeyError:
        print('Credentials not found.')
コード例 #19
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_enabled_public_certexpress_and_retail():
    time.sleep(2)

    actions.click('Company Settings')

    try:
        label = driver.find_element_by_xpath(
            '//*[@id="menu_container"]/ul/li[7]/ul/li[3]/ul/li[8]/a').text
        if debug:
            print('{} enabled.'.format(label))
    except NoSuchElementException:
        assert False, 'Public CertExpress is not enabled'

    try:
        label = driver.find_element_by_xpath(
            '//*[@id="menu_container"]/ul/li[8]/a').text
        if debug:
            print('{} enabled.'.format(label))
    except NoSuchElementException:
        assert False, 'Retail is not enabled.'

    assert True
    if debug:
        print('Public CertExpress and Retail are enabled.')
コード例 #20
0
ファイル: actions.py プロジェクト: hartleyn/sel-cc
def find_and_click_in_progress_campaign(campaign_name):
    time.sleep(5)
    x = 2
    check = True
    while check:
        try:
            label = driver.find_element_by_xpath(
                '//*[@id="incomplete_mailout_list"]/tbody/tr[{}]/td[2]'.format(
                    x)).text

            if campaign_name.lower() == label.lower():
                print('Found campaign: {}'.format(campaign_name))
                check = False
                driver.find_element_by_xpath(
                    '//*[@id="incomplete_mailout_list"]/tbody/tr[{}]/td[6]/a'.
                    format(x)).click()
                time.sleep(5)
            else:
                x += 1
        except NoSuchElementException:
            check = False
            print(
                'Finished searching in-progress campaigns. Campaign not found.'
            )
コード例 #21
0
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))
コード例 #22
0
ファイル: actions.py プロジェクト: hartleyn/sel-cc
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
コード例 #23
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_company_exists(company_name):
    actions.tabs_click('Company Hierarchy')

    time.sleep(2)

    x = 1
    check = True
    while check:
        try:
            label = driver.find_element_by_xpath(
                '//*[@id="company_entity"]/ul/li[{}]/div/span'.format(x)).text
            if company_name.lower() == label.lower():
                assert company_name.lower() == label.lower()
                print('Company found.')
                check = False
            else:
                x += 1
        except NoSuchElementException:
            print('Company not found.')
            assert False, print(
                company_name
            )  # Look will exit when there are no more elements present
コード例 #24
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_customers_imported(file):
    # list of customer numbers in the import file
    customer_numbers = read_import_file_customer_numbers(file)

    actions.customer_criteria_click('customer numbers input')

    for number in customer_numbers:
        ActionChains(driver).send_keys(number).send_keys(Keys.RETURN).perform()

    # time.sleep(2)

    actions.click('get search results button')

    time.sleep(3)

    count = driver.find_element_by_xpath('//*[@id="human_readable"]').text
    # 'count' is a string which starts with 'Found 14' e.g.
    # The following block checks if the number is a single or double digit number
    if count[7] == ' ':
        count = int(count[6])
    elif count[8] == ' ':
        count = int(count[6:8])
    assert count == len(customer_numbers)
    print('Customers imported successfully.')
コード例 #25
0
def select_exposure_zones(zones):  # :O - Almost 100 lines?
    if debug:
        print('Selecting zones')

    # Cast argument to a list if one wasn't passed in
    if type(zones) is not list:
        zones = [zones]

    # Click the 'Select None' link to ensure that all zones are unchecked
    click('exposure zone select none link')

    current_zone_type = ''

    for zone in zones:

        z = zone.lower()
        if z == 'state' or z == 'excise certificates' or z == 'excise licenses' or z == 'federal withholding' or z == 'custom zone' or z == 'vat':
            current_zone_type = z
        else:

            x = 1
            check = True
            found = False

            while check:
                try:
                    label = driver.find_element_by_xpath(
                        '//*[@id="send_request_exposures_table"]'
                        '/tbody/tr[{}]/td[1]/div/label/span[2]'.format(x)).text
                    print('Zone:', label)

                    if zone.title(
                    ) == label or label == zone.title() + ' Sales Tax':
                        check = False
                        found = True
                        print('found')
                    else:
                        x += 1
                except NoSuchElementException:
                    check = False

            if found:
                driver.find_element_by_xpath(
                    '//*[@id="send_request_exposures_table"]'
                    '/tbody/tr[{}]/td[1]/div/label/input'.format(x)).click()
            else:
                if current_zone_type == '':
                    print(
                        'No zone type set. Pass "state", "excise certificates", "excise licenses", '
                        '"federal withholding", "custom zone", or "vat" in the zones array to set zone type.'
                    )
                else:
                    zone = zone.title()
                    time.sleep(2)
                    click('add shipto zone button')

                    if current_zone_type == 'state':
                        try:
                            add_shipto_zone_state_modal_click('state link')
                            helpers.select_helper(
                                locations.Selects.
                                add_shipto_zone_state_modal_state, zone)
                            add_shipto_zone_state_modal_click(
                                'add shipto state button')
                        except NoSuchElementException:
                            if zone.endswith(' Sales Tax'):
                                zone_list = zone.split()
                                new_zone = ''

                                for x in range(0, len(zone_list)):
                                    if zone_list[x] != 'Sales' or zone_list[
                                            x] != 'Tax':
                                        new_zone += zone_list[x]

                                zone = new_zone
                            else:
                                zone += ' Sales Tax'

                            try:
                                add_shipto_zone_state_modal_click('state link')
                                helpers.select_helper(
                                    locations.Selects.
                                    add_shipto_zone_state_modal_state, zone)
                                add_shipto_zone_state_modal_click(
                                    'add shipto state button')
                            except NoSuchElementException:
                                print(
                                    'Sales and Use Tax exposure zone not found.'
                                )

                    elif current_zone_type == 'excise certificates':
                        add_shipto_zone_state_modal_click(
                            'excise certificates link')
                        helpers.select_helper(
                            locations.Selects.
                            add_shipto_zone_state_modal_excise_certificates,
                            zone)
                        add_shipto_zone_state_modal_click(
                            'add shipto zone button')
                    elif current_zone_type == 'excise licenses':
                        add_shipto_zone_state_modal_click(
                            'excise licenses link')
                        helpers.select_helper(
                            locations.Selects.
                            add_shipto_zone_state_modal_excise_licenses, zone)
                        add_shipto_zone_state_modal_click(
                            'add shipto zone button')
                    elif current_zone_type == 'federal withholding':
                        add_shipto_zone_state_modal_click(
                            'federal withholding link')
                        helpers.select_helper(
                            locations.Selects.
                            add_shipto_zone_state_modal_federal_withholding,
                            zone)
                        add_shipto_zone_state_modal_click(
                            'add shipto zone button')
                    elif current_zone_type == 'custom zone':
                        add_shipto_zone_state_modal_click('custom zone link')
                        helpers.select_helper(
                            locations.Selects.
                            add_shipto_zone_state_modal_custom_zone, zone)
                        add_shipto_zone_state_modal_click(
                            'add shipto zone button')
                    elif current_zone_type == 'vat':
                        add_shipto_zone_state_modal_click('vat link')
                        helpers.select_helper(
                            locations.Selects.add_shipto_zone_state_modal_vat,
                            zone)
                        add_shipto_zone_state_modal_click(
                            'add shipto zone button')
                    else:
                        print('Some zone type error occurred.')
コード例 #26
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_status_complete():
    status = driver.find_element_by_xpath('//*[@id="certificate_details_content"]/table[1]/tbody/tr/td[1]').text

    assert status == 'COMPLETE', 'Incorrect status found. Expected "COMPLETE", Found {}.'.format(status)
コード例 #27
0
ファイル: actions.py プロジェクト: hartleyn/sel-cc
def get_certificate_id():
    cert_id = driver.find_element_by_xpath(
        '//*[@id="dataEntryForm"]/div[2]/div/p/strong').text
    return cert_id
コード例 #28
0
ファイル: actions.py プロジェクト: hartleyn/sel-cc
def okta_login(environment):
    env = environment.lower()
    driver.get('https://avalara.okta.com/app/UserHome')

    try:
        check = driver.find_element_by_xpath('//*[@id="okta-signin-username"]').is_displayed()
        print('Logging in to Okta...')
        driver.find_element_by_xpath('//*[@id="okta-signin-username"]').click()
        driver.find_element_by_xpath('//*[@id="okta-signin-username"]').send_keys('*****@*****.**')

        driver.find_element_by_xpath('//*[@id="okta-signin-password"]').click()
        driver.find_element_by_xpath('//*[@id="okta-signin-password"]').send_keys('Nb1886afc')

        driver.find_element_by_xpath('//*[@id="okta-signin-submit"]').click()
        time.sleep(10)
    except NoSuchElementException:
        print('Already logged in to Okta...')
    finally:

        x = 1
        check = True
        while check:
            time.sleep(2)
            try:
                link_text = driver.find_element_by_xpath('//div[@id="main-content"]'
                                                         '/div/div[2]/ul[2]/li[{}]/p'.format(x)).text
                print(link_text)

                if link_text.lower() == env:
                    check = False
                else:
                    x += 1
            except NoSuchElementException:
                check = False

        driver.find_element_by_xpath('//div[@id="main-content"]/div/div[2]/ul[2]/li[{}]/a'.format(x)).click()

        time.sleep(2)

        # Okta opens chosen portal in a new window
        driver.switch_to_window(driver.window_handles[1])

        # Always sleep to compensate for long Okta load times
        time.sleep(20)
コード例 #29
0
ファイル: actions.py プロジェクト: hartleyn/sel-cc
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)
コード例 #30
0
ファイル: audits.py プロジェクト: hartleyn/sel-cc
def verify_certificate_validation():
    status = driver.find_element_by_xpath('//*[@id="validation"]/div[2]/table/tbody/tr/td[1]/span').text

    assert status == 'Valid', 'Incorrect validation status found. Expected "Valid", Found {}'.format(status)