C# WATIN을 사용하면 페이지에서 INPUT 태그 html 요소의 두 번째 발생 값을 얻는 방법은 무엇입니까?C# WATIN을 사용하여 INPUT 태그 HTML 요소의 값을 얻는 방법은 무엇입니까?
나는 여러 가지를 시도했지만 성공하지 못했습니다. 디버거는 반환 된 4 개 요소 중에서 [1] 요소를 가져올 명확한 방법을 제공하지 않습니다.
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
는 기본적으로, 나는 그것의 배열 인덱스에 의해 입력 요소를 선택할 수 있어야합니다.
좋은 아이디어! 감사. ;-) – djangofan