简体   繁体   English

无法使用Selenium IDE 2.9.0自动单击对下拉框的单击

[英]Unable to automate a click to a dropdown box using Selenium IDE 2.9.0

I am trying to automate a drop-down box on a site but I can't get Selenium to automatically click the box. 我正在尝试自动化网站上的下拉框,但无法让Selenium自动单击该框。 I've tried targeting all of the elements within this box and none work. 我尝试定位此框中的所有元素,但没有任何效果。

Can anybody please shed some light? 有人可以说明一下吗?

Many thanks 非常感谢

Try to use below code to select your required option ie, Level Term & Critical Illness from the Drop down: 尝试使用以下代码选择所需的选项,即从下拉菜单中选择“ 期限和危疾 ”:

    //first click on DropDown to open drop down options
    WebElement dropDown = driver.findElement(By
            .xpath(".//*[@id='QuoteAmend_PolicyType_chzn']/a"));
    dropDown.click();

    //Select second option from the drop down
    driver.findElement(
            By.xpath(".//*[@id='QuoteAmend_PolicyType_chzn_o_1']"))
            .click();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM