HTML code:
<button type="button" class="btn btn-main dropdown-toggle" dropdown-toggle="" aria-haspopup="true" aria-expanded="false">create
<span class="icon-dir-down"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
Using class name I tried to click on button but am not able to click.
I tried the following code:
driver.findElement(By.className("btn btn-main dropdown-toggle")).click();
Web Elementsin your project that you are finding viaclassName? And, are they working?className. @PeterRasmussen's answer is the best way to accomplish it.