简体   繁体   中英

Unable to locate element in selenium webdriver

when I am using the code as follows

Select (driver.findElement(By.id("visualizationid"))).selectByVisibleText("Week");

I am getting the error such as:

Unable to locate element:

{"method":"id","selector":"visualizationid"} Command duration or timeout: 30.12 seconds

Can't able to figure out exactly. The HTML code fragment looks like this:

<select id="visualizationId" style="width: 120px; display: none;" name="visualization">
    <option value="day">Day</option>
    <option value="week">Week</option>
    <option selected="" value="month">Month</option>
    <option value="quarter">Quarter</option>
    <option value="semester">Semester</option>
    <option value="year">Year</option>
    <!-- ... -->
</select>

You misspelled the ID; it's visualizationId rather than visualizationid . So, capital 'I' in the 'Id'.

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