Selenium how to Enter data in to tabular format frame - in horizontal way in UI [closed]

0 votes

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>
closed with the note: solved by self.
Apr 11, 2020 in Selenium by Jyra
• 580 points

closed Apr 13, 2020 by Jyra 1,153 views
Any sugusstions plz
Hey @Jyra, could you please post the solution too?

Related Questions In Selenium

0 votes
2 answers

How can we use JavaScript Executor to click and enter data to a web element in Selenium?

WebElement element = driver.findElement(By.id("abcd")); // Let the ...READ MORE

answered Mar 22, 2020 in Selenium by Lakshmi Sarvepalli
3,437 views
0 votes
6 answers

How to specify "ENTER" button functionality in Selenium WebDriver code?

using OpenQA.Selenium.Interactions; Actions builder = new Actions(driver); ...READ MORE

answered Feb 13, 2019 in Selenium by anonymous
96,103 views
0 votes
1 answer

How to use Enter/Return Key in Selenium

You can use the below code: import org.openqa.selenium.Keys WebEle ...READ MORE

answered Apr 18, 2018 in Selenium by Meci Matt
• 9,460 points
2,840 views
+2 votes
1 answer

How to press enter using selenium in Java?

Hey @jino, good that you are finding ...READ MORE

answered Dec 21, 2018 in Selenium by Priyaj
• 58,100 points

edited Oct 7, 2021 by Sarfaraz 4,528 views
0 votes
1 answer

How to switch back from a frame to default in Selenium Webdriver?

Hey Rupesh, to switch back from a ...READ MORE

answered Jun 25, 2019 in Selenium by Anvi
• 14,150 points
12,340 views
0 votes
1 answer
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,567 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,084 views
0 votes
2 answers

What is the role of TestNG & JUnit frameworks in Selenium?

TestNG and JUnit are test frameworks . it ...READ MORE

answered Sep 4, 2020 in Selenium by Sri
• 3,190 points
2,844 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,178 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP