I would like to select a DropDown from a list but HTML don't have select Tag I am not sure should i use Select class or what

前端 未结 2 2033
广开言路
广开言路 2020-12-12 03:22

I am new to selenium and i would like to perform a simple task I want to select a drop-down from a tab and i have used \"http://www.spicejet.com/\" as an Reference. There is

2条回答
  •  清歌不尽
    2020-12-12 04:03

    Its not a dropdown. It a menu, You can use Actions class to select the sub-menu you want. use below code :

    Actions action = new Actions(driver);
    action.moveToElement(driver.findElement(By.id("highlight-addons"))).clickAndHold(driver.findElement(By.xpath("//li/a[contains(text(),'SpiceMax')]"))).click().build().perform();
    

提交回复
热议问题