Extracting data with commands storeText ,csvread ,csvsave while using Loop

Good morning dear community,

as a beginner of appliying Kantu, I am trying to open various URLs, and saving text from these URL by using StoreText.

I am aware of using following commands, but I am uncertain in combining them succesfully.

{
“Name”: “Freitagabend”,
“CreationDate”: “2019-11-18”,
“Commands”: [
{
“Command”: “store”,
“Target”: “fast”,
“Value”: “!replayspeed”
},
{
“Command”: “csvRead”,
“Target”: “test.csv”,
“Value”: “”
},
{
“Command”: “open”,
“Target”: “{!col1}”,
“Value”: “”
},
{
“Command”: “storeText”,
“Target”: “xpath=//*[@id=“evaluation_all”]/div[2]/table/tbody/tr/td[1]/span”,
“Value”: “”
},
{
“Command”: “csvSave”,
“Target”: “Freitagabend.csv”,
“Value”: “”
}
]
}

The first column contains the URL I want to open. My aim is to create a macro, which can be applied by using an extendable csvfile.

I hope I stated my problem as clear as possible.

Feel free to answer or ask for further information.

Thank you in advance.

Fabian

you can save in csv file like below

{
  "Command": "store",
  "Target": "your_variable_or_value",
  "Value": "!csvLine"
},
{
  "Command": "csvSave",
  "Target": "Freitagabend",
  "Value": ""
}

Thank you very much, for trying to understand my problem.

In this case I am already appliying this command. I would like to have it this way:

csvread | test.csv
open | “various URLs taken from the csvfile / saved in different lines”
storeText | “xpath…”
csvSave | Freitagabend.csv

Furthermore I would like to have the opportunity, to extend the number of URLs in the file i want to read from.

I am very thankful for your answer!

Best regards

Fabian

i’m also looking for this.

As the ui vision documentation =>
Important: csvSave and csvRead operate on different CSV files. You can use both in your macro at the same time, but any value added with !csvLine will only modify the file used for csvSave. The data loaded with csvRead is read-only and can only be accessed via the read-only {!COLx} variables. But you can easily to "re-use" some of the loaded data for the output log file. Just add it to the output CSV file with store | {COl1} | !csvLine. In this example, we add the value from the first column of the input CSV file to the output CSV file.

please see this url : https://ui.vision/rpa/docs/selenium-ide/csvsave

Hope it will help you

If you found any other solutions, please share.

In detail my csvread file contains the various website numbers for example:

content csv file:

first row first line : “123456”
first row, second line: “789101”

The macro should insert the content in the URL, like

www.website.com/“123456”

and open it , storetext, csvsave

Then go on with following URL “789101” and so on.

I am sorry in case of understanding you wrong.

Try this, i hope it will work

{
"Name": "Freitagabend",
"CreationDate": "2019-11-18",
"Commands": [{
		"Command": "store",
		"Target": "fast",
		"Value": "!replayspeed"
	},
	{
		"Command": "csvRead",
		"Target": "test.csv",
		"Value": ""
	},
	{
		"Command": "open",
		"Target": "{!col1}",
		"Value": ""
	},
	{
		"Command": "storeText",
		"Target": "xpath=//*[@id="evaluation_all"]/div[2]/table/tbody/tr/td[1]/span",
		"Value": "new_Data"  // this is new variable return from storeText command ref:https://ui.vision/rpa/docs/selenium-ide/storetext
	},
	{
  		"Command": "store",
  		"Target": "${new_Data}",  // write new_data into csv with sore command
  		"Value": "!csvLine"
	},
	{
		"Command": "csvSave",
		"Target": "Freitagabend",
		"Value": ""
	}
]}

Remove comment from file

You must use a solution like this

Great step forward, thanks!

I am trying to understand your approach, but there are still things unclear.
My only problem now is, that the macro is conducting itself endlessly. I changed it like this:

{
“Command”: “label”,
“Target”: “xxxxx”,
“Value”: “”
},
{
“Command”: “store”,
“Target”: “180”,
“Value”: “!timeout_macro”
},
{
“Command”: “store”,
“Target”: “fast”,
“Value”: “!replayspeed”
},
{
“Command”: “echo”,
“Target”: “— Read CSV Test starts here —”,
“Value”: “”
},
{
“Command”: “label”,
“Target”: “TESTSTART”,
“Value”: “”
},
{
“Command”: “csvRead”,
“Target”: “test.csv”,
“Value”: “”
},
{
“Command”: “echo”,
“Target”: “Status = {!csvReadStatus}, line = {!csvReadLineNumber}”,
“Value”: “”
},
{
“Command”: “while”,
“Target”: “”{!csvReadStatus}\" == \"OK\"", "Value": "" }, { "Command": "echo", "Target": "status = {!csvReadStatus}, line = {!csvReadLineNumber}", "Value": "" }, { "Command": "open", "Target": "testwebsite{!col1}",
“Value”: “{!COL1}_{!csvReadLineNumber}”
},
{
“Command”: “storeText”,
“Target”: “xpath=//*[@id=“evaluation_all”]/div[2]/table/tbody/tr/td[1]/span”,
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “freitagabend.csv”,
“Value”: “”
},
{
“Command”: “storeEval”,
“Target”: "{!csvReadLineNumber}+1", "Value": "!csvReadLineNumber" }, { "Command": "store", "Target": "true", "Value": "!errorIgnore" }, { "Command": "echo", "Target": "Reading CSV line No. {!csvReadLineNumber} ",
“Value”: “!errorIgnore”
},
{
“Command”: “csvRead”,
“Target”: “test.csv”,
“Value”: “”
},
{
“Command”: “store”,
“Target”: “false”,
“Value”: “!errorIgnore”
},
{
“Command”: “endWhile”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “gotoLabel”,
“Target”: “xxxxx”,
“Value”: “”
}
]
}

I am not sure how to define my target/value in the command “endWhile” to achieve the end of the macro at the first empty cell of the csvread-file.

I found out, that one can remove the “gotoLabel” at the end.

What is the problem in this macro ?

Can you add the complete csv to test it ?

In my opinion this is a simple macro to create.

I do not understand your problem

The macro is now working, thank you for your help!