Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium IDE with chosen select elements

I'm trying to test a registration form with Selenium IDE, but am having trouble with select elements from the Chosen library: http://harvesthq.github.io/chosen/

I wonder if you can help me with the commands to select an option (could be any option by the way). I couldn't get past opening the dropdown with a simple mouseDown. Here's a sample webpage with both a single and multi select (download source files from the repository above.

<html>
<head>
    <link rel="stylesheet" href="chosen/public/chosen.min.css">
    <link rel="stylesheet" href="chosen/public/chosen.jquery.min.css">
    <script src="jquery-1.10.2.min.js"></script>
    <script src="chosen/public/chosen.jquery.min.js"></script>
</head>
<body>
    <select multiple class="chzn-select" style="width: 150px;">
        <option value="Test 1">Test 1</option>
        <option value="Test 2">Test 2</option>
        <option value="Test 3">Test 3</option>
    </select>
    <br><br>
    <select class="chzn-select" style="width: 150px;">
        <option value="Test A">Test A</option>
        <option value="Test B">Test B</option>
        <option value="Test C">Test C</option>
    </select>   

    <script type="text/javascript">
        $(".chzn-select").chosen();
    </script>
</body>
</html>
like image 937
MikkoP Avatar asked Mar 24 '23 03:03

MikkoP


1 Answers

Ok I did manage to crack it myself and it was as simple as:

Command: clickAt

Target: css=#id_country_chzn_o_1

(chooses the first item on a list of countries, use Firebug to find out what your ids are called)

like image 103
MikkoP Avatar answered Apr 24 '23 21:04

MikkoP