0

I have the below method:

PUBLIC methodname(WebDriver driver,formEntryMap<String,String>,String Colkey)
{
String Xpath = This will have the xpath of the input text box
inputfieldEntry(driver,Xpath,formEntryMap.get(ColKey));
}

This will read the value from the col

Feature file : Column | Value| SuceessNo | 1212 1414 |

Basically, the success 1212 and 1414 should be entered one below the other in the textbox so the input should be :

1212

1414

With the given method can someone give me inputs on how to "\n" in this method.

2
  • This question is better asked on Stack Overflow, not SQA.
    – Lee Jensen
    Jul 5 at 19:46
  • 1
    I would like to express that ALL questions related to Selenium are viable on this site. This site is the result of a merger between Selenium and Software Quality sites, and we should continue to honor that merger.
    – corsiKa
    Jul 7 at 2:59
0

For the table value put in something like "newline".

Feature: Foo
   
   Scenario Outline: Bar
     Given ...
     When I input <value>
     Then ...

     Examples:
       | value |
       | 1212  |
       |newline|

Then in the Step Definition just check for it.

public WhenIInput(string value) {
   if (value.toLower() == "newline"){
      SomePageObject.myElement.sendKeys(Envirionment.newLine);
   }
   else {
      SomePageObject.myElement.sendKeys(value);
   }
}
4
  • thanks for the response but_my question is i dont want to enter the text newline in the feature file and want to enter it only in the method:
    – user49933
    Jul 6 at 3:07
  • So in the method:Xpath.sendKeys(formEntryMap.get(colKey)); Xpath.sendKeys("newline"); this will not work how do i add this in the method to make it work
    – user49933
    Jul 6 at 3:08
  • String [] inputInfo = formEntryMap.get(columnKey).trim().split("\n"); for(String inputItem:inputInfo) { String xPath = Xpathofinputfield .inputEntry(driver, xPath,inputItem);
    – user49933
    Jul 6 at 5:13
  • given like this but still not adding the value in the next line any suggessions pls
    – user49933
    Jul 6 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.