sclevine / agouti

A WebDriver client and acceptance testing library for Go
MIT License
821 stars 103 forks source link

How can I get the text in a textbox? #132

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi. this library is very cool. but I dont know how to get text in textbox.

I try this code below:

target

<div class="parent1"><div class="parent2"><input type="text" size="40" value="" readonly ng-model="data"></div></div>

agouti

/*XPath to target element*/
fmt.Println(page.FindByXPath("/html/body/div/div/div[2]/section/section[3]/div/table/tbody/tr/td/div[3]/div/input").Text())
sclevine commented 7 years ago

I think you're looking for the value attribute: selection.Attribute("value")

ghost commented 7 years ago

Thank you so much!