reading text from textarea in webdriver

前端 未结 3 1881
别那么骄傲
别那么骄傲 2021-02-13 18:12

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():

            


        
3条回答
  •  被撕碎了的回忆
    2021-02-13 18:53

    So finding an element returns a web element. To get the text of the element you have to call getText(), so from above

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

提交回复
热议问题