我是靠谱客的博主 辛勤鞋子,这篇文章主要介绍how to convert WebElement to string in selenium using java?,现在分享给大家,希望可以做个参考。

how to convert WebElement to string in selenium using java?

By byXpath = By.xpath("//*[@id=‘content’]/table/tbody/tr/td[2]");
List links = driver.findElements(byXpath);

List texts = links.stream().map(WebElement::getText).collect(Collectors.toList());

OR
List links =driver.findElements(By.xpath("//*[@id=‘content’]/table/tbody/tr/td[2]"));

String []linkText =new String[links.size()];
int i=0;

//Storing List elements text into String array
for(WebElement a: links)
{
linkText[i]=a.getText();
i++;

最后

以上就是辛勤鞋子最近收集整理的关于how to convert WebElement to string in selenium using java?的全部内容,更多相关how内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(102)

评论列表共有 0 条评论

立即
投稿
返回
顶部