コード例 #1
0
def event_registration():
    driver = menu_button_click()
    if driver == "FAIL ON STAGE: Wrong login or password" or driver == "No such input fields" or driver == "FAIL ON STAGE: Open page" or driver == "FAIL ON STAGE: Click menu button":
        return driver

    try:
        element_production_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".bp3-submenu:nth-child(1) .bp3-text-overflow-ellipsis")))
    except:
        Print("Production button wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find production button"

    element_production_button.click()
    Print("Production button click")

    try:
        element_EventRegistration_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[3]/div/div/div/div[2]/ul/li[1]/span/div/div/div/div/ul/li[1]/span/span/a/div')))
    except:
        Print("EventRegistration button wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find EventRegistration button"

    element_EventRegistration_button.click()
    Print("EventRegistration click")
    return driver
コード例 #2
0
def ninth_case():
    driver = menu_button_click()
    if driver == "FAIL ON STAGE: Wrong login or password" or driver == "No such input fields" or driver == "FAIL ON STAGE: Open page" or driver == "FAIL ON STAGE: Click menu button":
        return driver

    try:
        element_production_button = WebDriverWait(driver, 10).until(
            EC.element_to_be_clickable(
                (By.CSS_SELECTOR,
                 ".bp3-submenu:nth-child(1) .bp3-text-overflow-ellipsis")))
    except:
        print("Production button wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find production button"

    element_production_button.click()
    print("Production button click")

    try:
        element_EventRegistration_button = WebDriverWait(driver, 10).until(
            EC.element_to_be_clickable((
                By.XPATH,
                '/html/body/div[3]/div/div/div/div[2]/ul/li[1]/span/div/div/div/div/ul/li[1]/span/span/a/div'
            )))
    except:
        print("EventRegistration button wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find EventRegistration button"

    element_EventRegistration_button.click()
    print("EventRegistration click")

    try:
        element_71NoSort_button = WebDriverWait(driver, 10).until(
            EC.element_to_be_clickable((
                By.XPATH,
                '/html/body/div[3]/div/div/div/div[2]/ul/li[1]/span/div/div/div/div/ul/li[1]/span/div/div[2]/div/div/ul/li[1]/a/div'
            )))
    except:
        print("71NoSort button wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find 71NoSort button"

    element_71NoSort_button.click()
    print("71NoSort click")

    time.sleep(2)

    driver.switch_to_window(driver.window_handles[1])

    try:
        element_without_courier_button = WebDriverWait(driver, 10).until(
            EC.element_to_be_clickable((
                By.XPATH,
                "/html/body/div[3]/div/div[2]/div/div[2]/div/div[1]/div[1]/button[2]/span"
            )))
    except:
        print("Without courier button wasn't found")
        driver.close()
        driver.switch_to_window(driver.window_handles[0])
        driver.close()
        return "FAIL ON STAGE: Find Without courier button"

    element_without_courier_button.click()

    print("Without courier button click")

    try:
        element_form_name = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((
                By.XPATH,
                "/html/body/div[1]/section/section[2]/section/section/div[1]/h1"
            )))
    except:
        print("Form name wasn't found")
        driver.close()
        driver.switch_to_window(driver.window_handles[0])
        driver.close()
        return "FAIL ON STAGE: Find form name"

    if element_form_name.text != "71. Прибыл на склад (без сортировки)":
        print("Wrong form was opened")
        driver.close()
        driver.switch_to_window(driver.window_handles[0])
        driver.close()
        return 'FAIL ON STAGE: Check form name'

    try:
        element_blockNumber_field = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((
                By.XPATH,
                "/html/body/div[1]/section/section[2]/section/section/div[2]/div[3]/div[2]/div/div/div[3]/form/input"
            )))
    except:
        print("Block number field wasn't found")
        driver.close()
        driver.switch_to_window(driver.window_handles[0])
        driver.close()
        return 'FAIL ON STAGE: Find block number field'

    element_blockNumber_field.send_keys("11-1111-1111\n")
    #element_blockNumber_field.send_keys(keys.RETURN)
    #element_frame = WebDriverWait(driver, 10).until(
    #    EC.presence_of_element_located(
    #     (By.XPATH, "/html/body/div[1]/section/section[2]/section/section/div[2]/div[3]/div[2]/div/div")))
    #colour_of_frame = element_frame.get_attrubute('style')

    #if colour_of_frame == 'background-color: rgb(194, 48, 48);':
    time.sleep(5)
    print("11-1111-1111 was input\nSuccess")
    driver.close()
    driver.switch_to_window(driver.window_handles[0])
    driver.close()
    return 'Success'
コード例 #3
0
def sixth_case():
    Password = "******"
    driver = menu_button_click()
    if driver == "FAIL ON STAGE: Wrong login or password" or driver == "No such input fields" or driver == "FAIL ON STAGE: Open page" or driver == "FAIL ON STAGE: Click menu button":
        return driver

    element_servise_button = WebDriverWait(driver, 10).until(
        EC.element_to_be_clickable((
            By.XPATH,
            '//html/body/div[3]/div/div/div/div[2]/ul/li[7]/span/span/a/div')))

    element_servise_button.click()

    try:
        element_Permissions_management_button = WebDriverWait(
            driver, 10
        ).until(
            EC.element_to_be_clickable((
                By.XPATH,
                '/html/body/div[3]/div/div/div/div[2]/ul/li[7]/span/div/div/div/div/ul/li[1]/span/span/a/div'
            )))
    except:
        Print("No tab after servise button click")
        driver.close()
        return "FAIL ON STAGE: Click servise button"

    Print("Servis button click")
    element_Permissions_management_button.click()

    try:
        element_Group_of_users_button = WebDriverWait(driver, 10).until(
            EC.element_to_be_clickable((
                By.XPATH,
                '/html/body/div[3]/div/div/div/div[2]/ul/li[7]/span/div/div/div/div/ul/li[1]/span/div/div/div/div/ul/li[1]/a/div'
            )))
    except:
        Print("No tab after Permissions management click")
        driver.close()
        return "FAIL ON STAGE: Click Permissions management button"

    Print("Permissions management button click")
    element_Group_of_users_button.click()

    try:
        element_create_group_button = WebDriverWait(driver, 10).until(
            EC.element_to_be_clickable((
                By.XPATH,
                "/html/body/div[1]/section/section[2]/section/section/div/div/div[1]/div[1]/button[1]/span[2]"
            )))
    except:
        Print("No page after group of users button click")
        driver.close()
        return "FAIL ON STAGE: Click group of users button button"

    Print("Group of users click")
    time.sleep(5)

    element_create_group_button.click()

    try:
        element_create_group_name_field = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located((
                By.XPATH,
                '/html/body/div[3]/div/div[2]/div/div[2]/form/div[1]/div/div/input'
            )))
    except:
        Print("No create group window")
        driver.close()
        return "FAIL ON STAGE: Click on create group button "

    element_create_group_name_field.send_keys(Password)

    try:
        element_save_group_name_button = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located((
                By.XPATH,
                '/html/body/div[3]/div/div[2]/div/div[2]/form/div[2]/button[1]/span'
            )))
    except:
        Print("No Save group button")
        driver.close()
        return "FAIL ON STAGE: Save new group"

    element_save_group_name_button.click()

    try:
        element_search_field = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located((
                By.XPATH,
                '/html/body/div[1]/section/section[2]/section/section/div/div/div[1]/div[2]/div/div/div/input'
            )))
    except:
        Print("Save group button wasn't cliked")
        driver.close()
        return "FAIL ON STAGE: Click on save group button"

    element_search_field.send_keys(Password)

    try:
        element_find_group = WebDriverWait(driver, 5).until(
            EC.element_to_be_clickable((
                By.XPATH,
                "/html/body/div[1]/section/section[2]/section/section/div/div/div[2]/div[1]/table/tbody/tr[1]/td[2]"
            )))
    except:
        Print("Crated group wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find created group"

    #if element_find_group.text != Password:
    #   Print("Find group with looks like name")
    #  driver.close()
    # return "FAIL ON STAGE: Find created group: Find group with looks like name"

    #Print("Group was found")

    try:
        element_delete_groop_button = WebDriverWait(driver, 5).until(
            EC.element_to_be_clickable((
                By.XPATH,
                "/html/body/div[1]/section/section[2]/section/section/div/div/div[1]/div[1]/button[4]"
            )))
    except:
        Print("Delete group button wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find delete group button"

    element_delete_groop_button.click()

    Print('Delete group button was clicked')

    try:
        element_delete_button = WebDriverWait(driver, 5).until(
            EC.element_to_be_clickable(
                (By.XPATH,
                 "/html/body/div[4]/div/div[2]/div/div[3]/div/div/a[1]")))
    except:
        Print("Delete button wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find delete button"

    element_delete_button.click()

    Print("Delete button was ckicked")
    # time.sleep(5)
    driver.close()
    return "Success"
コード例 #4
0
def eighth_case():
    driver = menu_button_click()
    if driver == "FAIL ON STAGE: Wrong login or password" or driver == "No such input fields" or driver == "FAIL ON STAGE: Open page" or driver == "FAIL ON STAGE: Click menu button":
        return driver

    try:
        element_production_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".bp3-submenu:nth-child(1) .bp3-text-overflow-ellipsis")))
    except:
        print("Production button wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find production button"

    element_production_button.click()
    print("Production button click")

    try:
        element_EventRegistration_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[3]/div/div/div/div[2]/ul/li[1]/span/div/div/div/div/ul/li[1]/span/span/a/div')))
    except:
        print("EventRegistration button wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find EventRegistration button"

    element_EventRegistration_button.click()
    print("EventRegistration click")

    try:
        element_71NoSort_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[3]/div/div/div/div[2]/ul/li[1]/span/div/div/div/div/ul/li[1]/span/div/div[2]/div/div/ul/li[1]/a/div')))
    except:
        print("71NoSort button wasn't found")
        driver.close()
        return "FAIL ON STAGE: Find 71NoSort button"

    element_71NoSort_button.click()
    print("71NoSort click")

    time.sleep(2)

    driver.switch_to_window(driver.window_handles[1])

    try:
        element_without_courier_button = WebDriverWait(driver, 10).until(
            EC.element_to_be_clickable(
                (By.XPATH, "/html/body/div[3]/div/div[2]/div/div[2]/div/div[1]/div[1]/button[2]/span")))
    except:
        print("Without courier button wasn't found")
        driver.close()
        driver.switch_to_window(driver.window_handles[0])
        driver.close()
        return "FAIL ON STAGE: Find Without courier button"

    element_without_courier_button.click()

    print("Without courier button click")

    try:
        element_form_name = WebDriverWait(driver, 5).until(
            EC.presence_of_element_located((By.XPATH, "/html/body/div[1]/section/section[2]/section/section/div[1]/h1")))
    except:
        print("Form name wasn't found")
        driver.close()
        driver.switch_to_window(driver.window_handles[0])
        driver.close()
        return "FAIL ON STAGE: Find form name"

    if element_form_name.text != "71. Прибыл на склад (без сортировки)":
        print("Wrong form was opened")
        driver.close()
        driver.switch_to_window(driver.window_handles[0])
        driver.close()
        return 'FAIL ON STAGE: Check form name'

    print("Success")

    time.sleep(5)
    driver.close()
    driver.switch_to_window(driver.window_handles[0])
    driver.close()
    return "Success"