This is a migrated thread and some comments may be shown as answers.

Unable to get dynamic RadComboBox Item selenium IDE

0 Answers 82 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Venkat
Top achievements
Rank 1
Venkat asked on 11 Apr 2012, 08:59 AM
HI,

i am using Selenium IDE for test purpose.i have tried with a sample program which has a combo-box has dynamically added items during page load. by selecting an item in a combobox and then a button action. selected item test will load to a textbox. it works fine. but when im testing this program with selenium IDE. instead selected item default item is displayed in a textbox. i got struck with this problem for a long time. please provide a better solution. sample code is followed by:

selenium IDE HTML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost:3623/" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
    <td>open</td>
    <td>/Default.aspx</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=ddItem_Arrow</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=ddItem_Input</td>
    <td>Item4</td>
</tr>
<tr>
    <td>click</td>
    <td>css=li.rcbHovered.</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=Button1</td>
    <td></td>
</tr>
 
</tbody></table>
</body>
</html>



Selenium IDE c# format :
selenium.Open("/Default.aspx");
selenium.Click("id=ddItem_Arrow");
selenium.Type("id=ddItem_Input", "Item4");
selenium.Click("css=li.rcbHovered.");
selenium.Click("id=Button1");
selenium.WaitForPageToLoad("30000");


sample program code

aspx page:

<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <telerik:RadComboBox ID="ddItem" runat="server">
        </telerik:RadComboBox>
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        <br/>
        <asp:TextBox ID="txtbxShow" runat="server"></asp:TextBox>
    </div>
    </form>
</body>

aspx.cs page

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        ddItem.Items.Add(new RadComboBoxItem("Item1"));
        ddItem.Items.Add(new RadComboBoxItem("Item2"));
        ddItem.Items.Add(new RadComboBoxItem("Item3"));
        ddItem.Items.Add(new RadComboBoxItem("Item4"));
    }
}
 
protected void Button1_Click(object sender, EventArgs e)
{
    txtbxShow.Text = ddItem.SelectedItem.Text;
}

Thanks and Regards,
Venkat

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
Venkat
Top achievements
Rank 1
Share this question
or