My List<Map<String,String>> Has below Data :
[{Test_Case_id=tc1, Delimiter=|,SourceFile=/tmp/tes.dat,targetFile=/tmp/tgt.file},
{Test_Case_id=tc2, Delimiter=;,SourceFile=/tmp/tes1.dat,targetFile=/tmp/tgt1.file},
{Test_Case_id=tc3, Delimiter=|,SourceFile=/tmp/tes2.dat,targetFile=/tmp/tgt2.file}]
In UI page, I have to enter these values in the table. the table looks like below
//<Header>
Test_Case_id Delimiter SourceFile TargetFile
<Input Box> <Input Box> <Input Box> <Input Box>
<Input Box> <Input Box> <Input Box> <Input Box>
<Input Box> <Input Box> <Input Box> <Input Box>
With the code below, it is writing data in the horizontal format
Test_Case_id Delimiter SourceFile TargetFile
tc1 tc2 tc3 <Input Box>
<Input Box> <Input Box> <Input Box> <Input Box>
<Input Box> <Input Box> <Input Box> <Input Box>
int counter =1;
for (WebElement inputhd: inputHeaders)
{
for (Map<String,String> fetchrow : fetchfilteredrows) // in fetchfilterdrows the above List<Map<String,String>> data is tored.
{
for (Map.Entry<String,String> entry : fetchrow.entrySet())
{
if(input.getText().equalsIgnoreCase(entry.getKey().trim()))
{
//////for (i=0; i<fetchfilteredrows.size(); i++)
{
WebElement inputText = inputhd.findElement(By.xpath(".following::input["+counter+"]"));
WebElement.EnterText(inputText, entry.getValue().trim());
//////}
}
}
counter =counter+1;
}
}
How can write the data to UI horizontally the first row, then enter the second row and enter the third row test case details.
Tried adding the for loop, which i have given in "//////" comments.. does not wrk out.
Selenium script has to enter the data like this:
Test_Case_id Delimiter SourceFile TargetFile
tc1 | /tmp/tes.dat /tmp/tgt.file
tc2 ; /tmp/tes1.dat /tmp/tgt1.file
tc3 | /tmp/tes2.dat /tmp/tgt2.dat
Element Structure is like Below.
<div class ="table-class">
<table class ="table-response">
<thead>
<tr>
<th class = "ng-binding" >Test_Case_id</th>
<th class="ng-binding"> Delimiter</th>
<th class="ng-binding"> SourceFile</th>
<th class="ng-binding"> TargetFile</th>
</tr>
</thead>
<tbody>
////first row in table
<tr class ="ng-scope">
<td class="ng-input">
<input class="ng-scope-input" id=Test_Case_id">
</td>
<td class ="ng-input">
<input class="ng-scope-input" id="Delimiter">
</td>
<td class ="ng-input">
<input class="ng-scope-input" id="sourceFile">
</td>
<td class ="ng-input">
<input class="ng-scope-input" id="TargetFile">
</td>
</tr>
////second row in table
<tr class ="ng-scope">
<td class="ng-input">
<input class="ng-scope-input" id=Test_Case_id">
</td>
<td class ="ng-input">
<input class="ng-scope-input" id="Delimiter">
</td>
<td class ="ng-input">
<input class="ng-scope-input" id="sourceFile">
</td>
<td class ="ng-input">
<input class="ng-scope-input" id="TargetFile">
</td>
</tr>
////third row in table
<tr class ="ng-scope">
<td class="ng-input">
<input class="ng-scope-input" id=Test_Case_id">
</td>
<td class ="ng-input">
<input class="ng-scope-input" id="Delimiter">
</td>
<td class ="ng-input">
<input class="ng-scope-input" id="sourceFile">
</td>
<td class ="ng-input">
<input class="ng-scope-input" id="TargetFile">
</td>
</tr>
</tbody>
</table>