Search code examples
pythonautomationsquish

How to get the text of drop down values in squish tool?


I have to verify the text of drop down list elements. How can I verify the same using python script in squish tool ?


Solution

  • Naive approach:

    Record (then replay) selecting each of the entries. Use exception handling to log accessing individual entries and be able to proceed to test script execution.

    More flexible approach:

    Recording selecting one of the entries. This gives you script code to make the open the drop down and the object name of the drop down list. Then use object.children() to get all child elements of the drop down list object.

    Pseudo example:

    drop_down_list = waitForObject(...)
    children = object.children(drop_down_list)
    test.verify("Entry 1", children[0].text)
    

    (You have to check the properties of the children to see which actual property contains the text or whatever else you want to verify.)