简体   繁体   中英

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. 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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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