I want to click on one button in automation using selenium webdriver & Phantom JS. But it is not clicking on button.
HTML Code :
<button id="play" class="next-play"><span>play</span></button>
@FindBy(css = "#play")
private WebElement Btnplay;
Since you have not provided detail HTML, I am going to assume that the application is build using some AJAX as well. There are few things, as we all know, become very important when AJAX is involved.
Problems and possible solutions:
driver.findElement(whatever)call you want to use Explicit wait and make sure the element state is ready to accept the click and then perform the click
I strongly suspect the last scenario is the case here and you may want to investigate the event triggered by the UI when you manually perform the action or dig into the application code.