在webdriver中从textarea读取文本 [英] reading text from textarea in webdriver

查看:86
本文介绍了在webdriver中从textarea读取文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java中编写Webdriver测试时,我试图从textarea中读取文本.由于某些原因,当我使用.getAttribute()时会返回null:

I am trying to read text from textarea when writing a webdriver test in Java. For some reason I am getting null back when I use .getAttribute():

     WebElement text = wd.findElement(By.id("edit-pi-sample-geo-id"));

     String textagain = text.getAttribute("aaaa");

我该如何解决?

推荐答案

我已经开始工作了.这是解决方案-

I got this working. Here is the solution-

    WebElement text = wd.findElement(By.id("edit-pi-analytics-tms-id"));
    String textagain = text.getAttribute("value");

我在我之前发布的代码示例中的textarea中使用了实际值,这有点愚蠢.谢谢大家的帮助

I was using the actual value in the textarea in the previous code example i posted which was kinda silly. Thanks guys for your help

这篇关于在webdriver中从textarea读取文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆