2009-07-16 6 views
0

브라우저에서 객체 '콤보 상자'의 속성 "name"을 추출하는 함수를 작성했습니다. 그러나 실행 후 오류가 발생하면 함수가 종료됩니다. 이 제 기능입니다셀렌 C#

Selenium.SeleniumException : ERROR: Command execution failure.The error message is: The expression cannot be converted to return the specified type. 

:

오류 메시지입니다


public void hladame_combo() 
{ 
    //combo boxes 
    string nazov_combo; 
    decimal celkovy_pocet_combo = selenium.GetXpathCount("//select"); 
    int c = 1; 
    string pomoc = ""; 
    for (c = 1;c<=celkovy_pocet_combo;c++) 
    { 
     nazov_combo = selenium.GetAttribute("xpath=//select" + pomoc + "@name"); 
     pomoc = pomoc + " and @name!= '" + nazov_combo + "'"; 
     Console.WriteLine(nazov_combo); 
    } 
    Console.WriteLine ("Celkovy pocet combo boxov je = " + celkovy_pocet_combo); 
} 
+0

문제는 여기 내가 생각하기에 : ("xpath = // select"+ pomoc + "@name"); –

+0

솔루션 : nazov_combo = selenium.GetAttribute ("xpath = // select"@class! = '' "+" "+ pomoc +"] @name "); –

답변

0

문제가 XPath는 있었다 ... 솔루션은 적합하지 않습니다하지만 helpfull

솔루션 : nazov_combo = selenium.GetAttribute ("xpath = // select [@class! = " '"+ ""+ pomoc + "] @name");