2017-05-18 2 views
0

셀레늄 C#을 가진 AutoCompleteExtender 자동화. 많은 Thread.Sleep을 사용하여 해결할 수 있었지만 느리고 기분이 좋았습니다.내가 제대로 자동 완성 필드를 자동화하기 위해 노력하고

나는이 코드 SNIPPIT에게 그것이 내가 다음과 같은 메시지

'List<IWebElement>' does not contain a definition for 'Get' and no extension method 'Get' accepting a first argument of type 'List<IWebElement>' could be found (are you missing a using directive or an assembly reference?) 
을 얻고 곳 그러나 나는 listItems.Get에 문제를 타격하고 트릭을

driver.findElement(By.id("your searchBox")).sendKeys("your partial keyword"); 
Thread.sleep(3000); 
List <WebElement> listItems = driver.findElements(By.xpath("your list item locator")); 
listItems.get(0).click(); 
driver.findElement(By.id("your searchButton")).click(); 

을 할 것 같다 몇 번 발견

나는 Google에서 사냥을 한 적이 있는데 dll이 누락 된 경우 또는 내가 get을 바꿔서이 작업을 수행 할 수 없으면 볼 수 없다.

답변

0

시도하십시오 listItems.ElementAt (0). 당신은 완벽한 고맙다이다 using System.Linq

+0

을 추가해야 할 수 있습니다! – Smithy7876

+0

도움이되기를 기쁘게 생각합니다 :) – iamkenos