Element should have been “select” but was “div” getting an error in selenium

前端 未结 3 1879
广开言路
广开言路 2020-12-07 06:07

Here is the HTML code, i\'m trying to select \'select customer\' drop-down.

3条回答
  •  盖世英雄少女心
    2020-12-07 06:28

    First check that:

    Drop down in your UI/FrontEnd is using "select" method or not ?

    And if not then use below snippet that will click in drop down and select value.

    WebElement selectMyElement = driver.findElement(this.getObject(By.Id("Id of Your DropDown"))); 
    selectMyElement.click();
    
    Actions keyDown = new Actions(driver);
    keyDown.sendKeys(Keys.chord(Keys.DOWN, Keys.DOWN)).perform();
    

提交回复
热议问题