Element cannot locate with the text- selenium webdriver

前端 未结 2 917

Currently working on selenium webdriver and the using the language Java.

Log.info(\"Clicking on To weekrange dropdown\");
JavascriptExecutor executor25 = (J         


        
2条回答
  •  误落风尘
    2020-12-21 12:51

    Try this:

    new Select(driver.findElement(By.id("fromWeekYear")).selectByValue("2010");
    new Select(driver.findElement(By.id("toWeek")).selectByValue("1");
    

    Value is single, use value.

    If by text, your text has space:

    new Select(driver.findElement(By.id("fromWeekYear")).selectByVisibleText(" 2010");
    new Select(driver.findElement(By.id("toWeek")).selectByVisibleText(" W 1");
    

    Other issue is that maybe your space is (& nbsp;)

提交回复
热议问题