Skip to main content

Using writeCSVFile API in Sahi.

Below code example shows how to use writeCSVFile API.

_navigateTo("http://localhost:8080/Appvance/login.html");
_setValue(_textbox("username"), "appvance");
_setValue(_password("password"), "appvance");
_click(_submit("Login"));
//user function
var htmlelement1 = "username";
var value1 = "appvance";
var htmlelement2 = "password";
var value2 = "appvance";
//capture elements and write to CSV
var array = [[htmlelement1,value1],[htmlelement2,value2]];
_writeCSVFile(array, "elements1.csv", true);
//another way of declaring array and writing to CSV
var $datatowrite1 = [];
$datatowrite1[0] = [htmlelement1,value1];
$datatowrite1[1] = [htmlelement2,value2];
_writeCSVFile($datatowrite1, "elements.csv", true);
_writeCSVFile($data, "userinfo.csv", true); // overwrites data into userinfo.csv
To get value of some element below step can be used. 
var value1 = "_getText(_div("/someclass/"))";
===============================================
writeFile
_writeFile("Value", "FilePath"); // appends second line in file



            
                    


Last updated: March 09, 2023

If you have any feedback on this topic, please contact us at documentation@appvance.ai