コード例 #1
0
def slack_panel():
    driver.execute_script("window.open('https://jojack.slack.com/');")
    driver.switch_to_window(driver.window_handles[2])  # SHOW SLACK
    time.sleep(7)  # WAIT 7 SECONDS!

    mail = driver.find_element_by_css_selector('input[type="email"]')
    mail.send_keys(credentials.slack_mail)
    time.sleep(3)
    ps = driver.find_element_by_css_selector('input[type="password"]')
    ps.send_keys(credentials.slack_pass)

    submit_button = driver.find_element_by_xpath(
        '/html/body/div[1]/div[1]/div[2]/div/form/p[5]/button')
    submit_button.click()
    time.sleep(1)
    jump_to = driver.find_element_by_xpath(
        "/html/body/div[2]/div/div/div[3]/div/nav/div[1]/button")
    jump_to.click()
    search_for_channel = driver.find_element_by_xpath(
        "/html/body/div[6]/div/div/div/div[1]/div/div/div[1]/p")
    search_for_channel.send_keys("Cengiz")
    time.sleep(1)
    search_for_channel.send_keys(Keys.ENTER)
    time.sleep(5)

    driver.switch_to_window(driver.window_handles[0])  # SHOW THE MM PANEL
コード例 #2
0
ファイル: scenario.py プロジェクト: igefimov/selenium
def test_ext_links(driver):
    test_login(driver)
    driver.get(
        "http://localhost/litecart/public_html/admin/?app=countries&doc=countries"
    )
    driver.find_element_by_xpath(".//*[@id='content']/div/a").click()
    all_ex_link = driver.find_elements_by_xpath(
        ".//*[@id='content']/form/table//a[@target='_blank']")
    print("Total ext_link: " + str(len(all_ex_link)))
    # получаем набор текущих открытых окон
    main_window = driver.current_window_handle
    print('main_window')
    print(main_window)
    old_windows = driver.window_handles
    print('old_windows')
    print(old_windows)
    # нажимаем на ссылку, которая открывает документ в новом окне
    for j in range(2):
        for i in range(len(all_ex_link)):
            print("i=" + str(i))
            with wait_for_new_window(driver, 10):
                all_ex_link[i].click()
            # получаем новый набор включающий уже новое окно
            new_windows = driver.window_handles
            print('new_windows')
            print(new_windows)
            # получаем новые окна (из одного списка вычтем другой)
            new_window = list(set(new_windows).difference(old_windows))
            print('new_window')
            print(new_window)
            # закрываем новое окно
            driver.switch_to_window(new_window[0])
            driver.close()
            driver.switch_to_window(main_window)
コード例 #3
0
def cp10_cid():
    if len(filtered_cid) > 0:
        time.sleep(2)   # WAIT 2 SECONDS!
        # SHOW THE REPORTING5 PANEL
        driver.switch_to_window(driver.window_handles[1])

        userid_box = driver.find_element_by_name(
            'txtUserID')       # Reporting5
        # Reporting5
        userid_box.clear()
        userid_box.send_keys(filtered_cid[-1])

        show_report = driver.find_element_by_name(
            'btnShowReport')  # Reporting5
        show_report.click()

        time.sleep(2)
        get_data_from_r5()

    else:
        refresh_button = driver.find_element_by_xpath(
            "/html/body/div/div/div[2]/div/div/div/div/div/ui-view/div/div/div[2]/div/section/div[3]/button[1]")
        refresh_button.click()
        time.sleep(10)   # WAIT 10 SECONDS!
        get10_cid()
コード例 #4
0
def approve_withdraw():
    driver.switch_to_window(driver.window_handles[2])
    send_message = driver.find_element_by_xpath(
        "/html/body/div[2]/div/div/div[4]/div/div/footer/div/div/div[1]/div/div[1]")
    send_message.send_keys(
        filtered_time_withdraw[-1], " ", filtered_cid[-1], " - ", cek_ok)
    send_message.send_keys(Keys.ENTER)
    amount.clear()
    filtered_trans_type.clear()
    filtered_last_note.clear()
    filtered_number_row.clear()
    del filtered_cid[-1]
    del filtered_time_withdraw[-1]
    driver.switch_to_window(driver.window_handles[0])
    cp10_cid()
コード例 #5
0
def reporting5_panel():

    if len(driver.window_handles) > 1:
        driver.switch_to_window(driver.window_handles[1])
    time.sleep(3)

    activity_button = driver.find_element_by_link_text('Activity')
    activity_button.click()

    transactions_button = driver.find_element_by_link_text('Transactions')
    transactions_button.click()

    deposit_click = driver.find_element_by_id('chkTransType_0')
    deposit_click.click()
    time.sleep(1)  # WAIT 1 SECOND!

    withdraw_click = driver.find_element_by_id('chkTransType_1')
    withdraw_click.click()
    time.sleep(1)  # WAIT 1 SECOND!

    vendor2user_click = driver.find_element_by_id('chkTransType_4')
    vendor2user_click.click()
    time.sleep(1)  # WAIT 1 SECOND!

    wallet_debit = driver.find_element_by_id('chkTransType_7')
    wallet_debit.click()
    time.sleep(1)  # WAIT 1 SECOND!

    processing_click = driver.find_element_by_id('cbxTransStatus_1')
    pending_click = driver.find_element_by_id('cbxTransStatus_3')
    processing_click.click()
    pending_click.click()
    time.sleep(1)  # WAIT 1 SECONDS!

    start_day = driver.find_element_by_xpath(
        '/html/body/form/div[3]/table/tbody/tr/td[1]/table/tbody/tr[3]/td[2]/table/tbody/tr/td[2]/input[1]'
    )
    start_day.clear()
    start_day.click()
    start_day.send_keys('13/11/2019')
コード例 #6
0
def get_time():
    for i in range(1, 31):
        time_withdraw = driver.find_elements_by_xpath(
            f"/html/body/div/div/div[2]/div/div/div/div/div/ui-view/div/div/div[2]/div/ubo-tma-table/div/div[2]/table/tbody/tr[{i}]/td[1]/span[2]")
        filtered_time_withdraw.append(time_withdraw[0].text)

    last_kt.append(filtered_time_withdraw[0])
    if len(last_kt) > 1:
        if last_kt[0] in filtered_time_withdraw:
            index_last_kt = filtered_time_withdraw.index(last_kt[0])
            del filtered_time_withdraw[index_last_kt:]
            del filtered_cid[index_last_kt:]
            del last_kt[0]
        else:
            driver.switch_to_window(driver.window_handles[2])
            send_message = driver.find_element_by_xpath(
                "/html/body/div[2]/div/div/div[4]/div/div/footer/div/div/div[1]/div/div[1]")
            send_message.send_keys("NU EXISTA DEPOSIT. CONTROLEAZA MANUAL!")
            send_message.send_keys(Keys.ENTER)
            driver.switch_to_window(driver.window_handles[0])
            del last_kt[0]
    cp10_cid()
コード例 #7
0
def find_deposit(filtered_trans_type, amount, balance, counter_withdraw):
    if filtered_last_note[-1] == "gh":
        print("gh eklemesi var.")
        approve_withdraw()

    elif filtered_trans_type[-1] == "Deposit" or filtered_trans_type[-1] == "Vendor2User":
        for i in range(len(filtered_trans_type)-1, 0, -1):
            if filtered_trans_type[i-1] == "WalletDebit":
                balance -= float(amount[i-1])
                del amount[-1]
                del filtered_trans_type[-1]
                if balance <= 0:
                    approve_withdraw()
                    break
                if i == 1:
                    decline_withdraw(balance)
                    break

            elif i == 1 and filtered_trans_type[i-1] == "Withdraw":
                decline_withdraw(balance)
                break

            elif 'WalletDebit' not in filtered_trans_type:
                driver.switch_to_window(driver.window_handles[2])
                send_message = driver.find_element_by_xpath(
                    "/html/body/div[2]/div/div/div[4]/div/div/footer/div/div/div[1]/div/div[1]")
                send_message.send_keys(
                    filtered_time_withdraw[-1], " ", filtered_cid[-1], " - ", amount[-1], " ", cek_decline)
                send_message.send_keys(Keys.ENTER)
                amount.clear()
                filtered_trans_type.clear()
                filtered_last_note.clear()
                filtered_number_row.clear()
                del filtered_cid[-1]
                del filtered_time_withdraw[-1]
                driver.switch_to_window(driver.window_handles[0])
                cp10_cid()
                break

    elif counter_withdraw >= 2:                  # If we have 2 withdraws in list -> approve withdraw
        print("2 cekimi var...")
        approve_withdraw()

    elif filtered_trans_type[-1] != "Deposit" or filtered_trans_type[-1] != "Vendor2User":
        driver.execute_script("window.scrollTo(0, 3000)")
        time.sleep(5)

        current_page = driver.find_element_by_xpath(
            f"/html/body/form/div[3]/div[5]/span")
        filtered_current_page.append(current_page.text)

        span = driver.find_element_by_xpath(
            f"/html/body/form/div[3]/div[5]/a[{int(filtered_current_page[-1])+2}]")
        if int(filtered_current_page[-1]) > 5:
            approve_withdraw()
        # if int(filtered_current_page[-1]) >= 11 and int(filtered_current_page[-1]) < 21:
        #     span = driver.find_element_by_xpath(
        #         f"/html/body/form/div[3]/div[5]/a[{int(filtered_current_page[-1])-7}]")
        # elif int(filtered_current_page[-1]) >= 21 and int(filtered_current_page[-1]) < 31:
        #     span = driver.find_element_by_xpath(
        #         f"/html/body/form/div[3]/div[5]/a[{int(filtered_current_page[-1])-17}]")

        span.click()
        filtered_number_row.clear()
        filtered_current_page.clear()
        get_data_from_r5()