通过在方法中使用拆分函数添加了“\n”,但在 运行 脚本时不起作用。我能得到一些意见吗

Added "\n" by using the split function in the method but is not working while running the Script. Can I get some inputs

/* 这是我的方法 */

    public static void inputvalues(WebDriver driver,Map<String, String> formEntryMap,String col) 
    {
        if(formEntryMap.containsKey(columnKey))
        {   
            String [] inputInfo = formEntryMap.get(colKey).trim().split("\n");
            
            for(String inputItem:inputInfo)
            {
                String xPath = XpathofInputfield
                inputEntry(driver, xPath,inputItem);
        
            }
        }
    }

特征文件定义如下:

| Column | Value         |
                                                                       
| Status | 542567 785454 |

现在,当我 运行 上面的文件时,它应该在状态文本框中将值一个一个地添加到另一个下方。 所以在添加它时应该是这样的:542567
785454
但问题是它没有像那样添加值,只是根据 Feature File.
中给出的值添加 我的要求:应该通过读取方法拆分并添加换行符中的值。

我需要一个解决方案。有人可以提供您的意见吗?

看看这是否有效:将您的 split() 更改为

String [] inputInfo = formEntryMap.get(colKey).trim().split("\W+");

更新代码: 你的 inputEntry() 应该是这样的:-

xpath.sendKeys(inputItem,"\n");