[Python] How to loop datasource in UI.Vision

Discussão em 'Python' iniciado por Stack, Dezembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    I created a functioning script that opens a page, selects options 1 and 2 from a.csv file, and submits; it then loops and repeats the process. Everything has been wonderful up to this point. Just one issue: it does not utilize row 2 from try number 2.

    So, for example, row one options 1 and 2 are orange and fruit, respectively, whereas row 2 options 1 and 2 are carrot and vegetable. However, when I execute the script, even if I loop it ten times, it will continue to publish orange and fruit rather than attempting 20 additional entries.CSV file.

    I'm posting my basic code here in case someone can spot the problem and fix it so that I may attempt the loop with data from the following line on successive tries.

    thankyou

    {
    "Name": "document",
    "CreationDate": "2024-12-10",
    "Commands": [
    {
    "Command": "store",
    "Target": "danny.csv",
    "Value": "csvFile",
    "Description": ""
    },
    {
    "Command": "csvRead",
    "Target": "${csvFile}",
    "Value": "",
    "Description": ""
    },
    {
    "Command": "while",
    "Target": "${!csvReadStatus} == \"OK\"",
    "Value": "",
    "Description": "Loop through CSV rows"
    },
    {
    "Command": "open",
    "Target": "MY URL",
    "Value": "",
    "Description": ""
    },
    {
    "Command": "type",
    "Target": "name=Option1",
    "Value": "${!COL1}",
    "Description": ""
    },
    {
    "Command": "type",
    "Target": "name=Option2",
    "Value": "${!COL2}",
    "Description": ""
    },
    {
    "Command": "click",
    "Target": "xpath=//button[@type='submit']",
    "Value": "",
    "Description": ""
    },
    {
    "Command": "pause",
    "Target": "2000",
    "Value": "",
    "Description": ""
    },
    {
    "Command": "csvRead",
    "Target": "${csvFile}",
    "Value": "",
    "Description": "Read next row"
    },
    {
    "Command": "endWhile",
    "Target": "",
    "Value": "",
    "Description": ""
    }```

    Continue reading...

Compartilhe esta Página