Using C# WATIN, how do I get the value of a INPUT tag html element?
Posted
by djangofan
on Stack Overflow
See other posts from Stack Overflow
or by djangofan
Published on 2010-06-04T22:39:25Z
Indexed on
2010/06/08
22:22 UTC
Read the original article
Hit count: 760
Using C# WATIN, how do I get the value of the second occurence of a INPUT tag html element on a page?
I've tried a whole bunch of things and haven't succeeded. The debugger isn't giving me any obvious way to get element[1] among the 4 that returned.
Console.WriteLine(ie.Element(Find.ByClass("myclass")).GetAttributeValue("value") ) ;
// works but prints the value of the 1st of 4 input elements on the page
Console.WriteLine(ie.ElementsWithTag("input", "text").Length.ToString() );
// returns the number 4
Console.WriteLine( ie.Element(Find.ByName("login")).GetAttributeValue("value") );
// works but its not safe since its possible there might be two elements with the name login
Basically, I want to be able to select the input element by its array index.
© Stack Overflow or respective owner