V
V
vadimeasy2022-01-21 13:02:57
Python
vadimeasy, 2022-01-21 13:02:57

How to consistently take data from a table and validate it in python?

I'm making a bot for the site I'm working on. Decided to automate settings for users. It happens that there is a large table with user data and I need to enter this data on the site according to certain criteria. How can I write a loop so that the program pulls out one value for the necessary variables from the file and inserts them into the site, and when the data in the column ends, it stops.

sendler_edi = input("введите отправителя:")
byer_edi = input("введите получателя:")

    sendler = driver.find_element_by_class_name('select2-selection__arrow').click()
    senler_input = driver.find_element_by_xpath('/html/body/span/span/span[1]/input').send_keys(sendler_edi)
    time.sleep(1)
    senler_input_enter = driver.find_element_by_xpath('/html/body/span/span/span[1]/input').send_keys(Keys.ENTER)
    time.sleep(2)

    byer = driver.find_element_by_xpath('//*[@id="fgr_receiver"]/div/span/span[1]/span').click()
    byer_input = driver.find_element_by_xpath('/html/body/span/span/span[1]/input').send_keys(byer_edi)
    time.sleep(1)
    byer_input_enter = driver.find_element_by_xpath('/html/body/span/span/span[1]/input').send_keys(Keys.ENTER)
    time.sleep(1)

    edi_provieder = input("Введите число, где 1 - Корус. 2 - E-COM")

    if edi_provieder == ("2"): 
        provider = driver.find_element_by_xpath('//*[@id="fgr_provider"]/div/span/span[1]/span').click()
        time.sleep(1)
        provider_ecom = driver.find_element_by_xpath('/html/body/span/span/span[2]/ul/li[3]')
        time.sleep(1)
        provider_ecom.click()

    # if edi_provider == ("1"):
        # там сям, сяо ляу 
    # 12098765431
    # 546218648
    message_type = driver.find_element_by_xpath('//*[@id="fgr_messageType"]/div/span/span[1]/span').click()
    time.sleep(1)
    message_type = driver.find_element_by_xpath('/html/body/span/span/span[2]/ul/li[2]')
    time.sleep(1)
    message_type.click()
    
    active_btn = driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div/div[1]/div[2]/div/form/div[5]/div/label').click()

    save_and_close = driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div/div[1]/div[3]/div/div/button[3]').click()
    time.sleep(1)
this script creates one setting for the client. How do I instead
sendler_edi = input("введите отправителя:")
byer_edi = input("введите получателя:")
to take this data from the table?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
Ukrainskiy, 2022-01-21
@Ukrainskiy

https://linuxhint.com/read-excel-file-python/ - as an option. What is the problem with googling?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question