Forum Discussion

coffee's avatar
coffee
Contributor
8 years ago
Solved

Select method (JS) to select something from drop-down list

Hi,   In Selenium Java, we can have this code here to select something from drop-down list :   Select s = new Select(driver.findElement(By.xpath("//path_to_drop_down"))); s.selectByVisibleText("V...
  • AlexKaras's avatar
    AlexKaras
    8 years ago

    Hi,

     

    > Not a Test Object from Page.QuerySelector ("CSS Selector Path") ?

    Yes, correct.

    .QuerySelector() is a native DOM method that returns native element which, obviously, does not contain TestComplete-specific .ClickItem() method.

    The reason that the call to .QuerySelector() method is possible is because TestComplete provides access to both its methods and methods that are native to the given tested application (web and/or desktop).

    .FindXXX() method provided by TestComplete returns wrapped object that provides access to all methods provided by TestComplete.

     

    As for the variable type - JScript is a scripting language and, as in any scripting language, its variables are OLE-compatible ones, which means that the actual type is insignificant (in most cases) and is handled internally by script runtime engine.

     

    And as a final note, I would suggest to use search methods provided by TestComplete and not native ones that you might got used to with Selenium because TestComplete's search functionality is more functional, flexible and cross-browser.