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>
I tried :
@FindBy(css = "#play")
private WebElement Btnplay;
Btnplay.click();
I also tried :
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click();", Btnplay);
Above same things I tried with ID and XPATH as well but not working with phantomJS. It works when I use any browser.
I took screenshots run time and I can see it is not clicking on button.
When I see error in console, It says unable to find element [which is in next page after click on play]. so it seems might be it is clicking but not going to next page.
Note : Website is built using Html/Css and JS. On click on button,it just changes screens by JS.
UPDATE : It is clicking on element and going to next screen. Issue is in next screen there are 4 elements but When I checked via screenshot , It shows only 2 Elements on page. Should I use element visibility wait?