I have a query Is that even possible to pass the variable value from the test case to the data file? If yes, then how?
//Get The count of the projects Pagination first:
List<WebElement> Lists_Count = WebUiCommonHelper.findWebElements(Project_Pagination_Row , 30)
//Get the size of the lists
int columns_count = Lists_Count.size()
println("Total number of saved lists are: " + columns_count)
WebUI.delay(5)
if (columns_count > 0)
{
for (int i = 0; i< columns_count; i++ )
{
ExpectedText = Lists_Count.get(i).getText()
println("Pagination no is: " + ExpectedText)
}
}
The above is the code written in TestCase1. I want to get the value of the ExpectedText and utilize this value in the data file.
@kazurayam
I am using the DATA-DRIVEN approach so instead of getting the hard-coded data I am getting the data/value using (Excel or CSV or internal file) files
By Data file, I mean this
First I get the count of the pagination numbers. The last value I get (Highlighted in the image below) I want to pass it to the File that ExpectedText value will decide which pagination number to click.
WebUI.delay(5)
//Get The count of the projects Pagination first:
List<WebElement> Lists_Count = WebUiCommonHelper.findWebElements(Project_Pagination_Row , 30)
//Get the size of the lists
int columns_count = Lists_Count.size()
println("Total number of saved lists are: " + columns_count)
if (columns_count > 0)
{
for (int i = 0; i< columns_count; i++ )
{
ExpectedText = Lists_Count.get(i).getText()
println("Pagination no is: " + ExpectedText)
}
}
```
As you can see in the below code I am trying to replace the PagCount with Pagination_Row_No (given from Data file)
So, I want to pass the ExpectedText Value in this column named Pagination_Row_No in Data file.

The Xpath for the pagination row is:
//ul[@class = "pagination b-pagination"]/li/button[@class ="page-link" and contains(text(),PagCount)]
TestObject myTest = findTestObject("Object Repository/Project_Page_Xpaths/Bulk_Operations/Project_Pagination_Count")
String test = myTest.findPropertyValue("xpath")
test = test.toString().replace("PagCount", Pagination_Row_No)
println(test)
myTest.findProperty("xpath").setValue(test)
WebUI.waitForElementPresent(myTest, 30)
//clicking the required pagination count
WebUI.click(myTest)
WebUI.delay(5)