Search code examples
javascriptcseleniumgetelementbyidgetelementsbytagname

selenium locate no id or name 's elements using javascript


I always locate element by getElementId,

and sent value by using

document.getElementId(id).value = "something".

but I found an button without Id or Name

< input type="submit" class="button" accesskey="l" value="click me" tabindex="3">

now how can I locate it ???


Solution

  • I think you need:

    IWebElement element = webDriver.FindElement(By.ClassName("button"));
    

    Though I don't understand what you are currently using from selenium?