tags:

views:

430

answers:

1

Hi all, I wrote a function for extracting attribute "name" of object 'combo box' from browser. But after execution function finishes with an error.

This is the error message:

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

This is my function:


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);
}
A: 

problem was in xpath ... solution is not ideal but helpfull

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

Peter_Tester