selenium 获取input输入框中的值的方法
2017-03-13 本文已影响0人
宇文臭臭
方法一:获取input的文本值
![](https://img.haomeiwen.com/i3265068/d070de14e1471a06.png)
chrome.findElement( By.id("txtName") ).getText();
方法二:获取input中value的值
![](https://img.haomeiwen.com/i3265068/f41fc102ff78c92f.png)
chrome.findElement(By.id("txtName") ).getAttribute("value") ;
方法一:获取input的文本值
chrome.findElement( By.id("txtName") ).getText();
方法二:获取input中value的值
chrome.findElement(By.id("txtName") ).getAttribute("value") ;