Element cannot locate with the text- selenium webdriver

前端 未结 2 909

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

    0 讨论(0)
  • 2020-12-21 13:01

    You have some spacing issues:

    driver.findElement(By.id(" toWeek")));

    Should not have a space in the id:

    driver.findElement(By.id("toWeek")));

    0 讨论(0)
提交回复
热议问题