Selenium : Enter data in table multiple rows [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;
}
}
Apr 11 in Selenium by Jyra
• 490 points

closed Apr 13 by Sirajul 52 views

Related Questions In Selenium

0 votes
1 answer

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 21 in Selenium by Lakshmi Sarvepalli
499 views
+3 votes
1 answer

How to read excel file numeric data of all rows and column in selenium? I have 10 rows and 5 column but I read Only String value not a Numeric value?

Hey, @Mahendra, check this thread https://www.edureka.co/community/52170/read-numeric-data-from-excel-sheet-using-selenium-webdriver It deals with ...READ MORE

answered Jan 27 in Selenium by Sirajul
• 53,080 points
243 views
0 votes
0 answers

Selenium : how to Enter data in to tabular format frame - in horizontal way in UI

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, ...READ MORE

Apr 11 in Selenium by Jyra
• 490 points

closed Apr 13 by Jyra 123 views
0 votes
3 answers

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

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

answered Feb 12, 2019 in Selenium by anonymous
28,797 views
+2 votes
2 answers

How can I press ENTER key with the execute_script in selenium python?

The below code containing Keys.ENTER might just ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,510 points
13,761 views
0 votes
1 answer

Reading data from Excel in my Selenium test

Log4j problems are usually thrown because of ...READ MORE

answered Apr 6, 2018 in Selenium by nsv999
• 5,510 points
7,107 views
0 votes
1 answer

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,510 points
2,611 views
0 votes
1 answer
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,870 points
2,055 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,870 points
2,164 views