I click on Smile.png =>
I use selenium for my UX testing. On chrome web driver a javascript alert with a "OK" message is display and my cucumber code close this javascript alert. My problem is with phantomJS web driver: the javascript alert with a "OK" message is not display and my cucumber code have an error (org.openqa.selenium.UnsupportedCommandException: Invalid Command Method)
<html>
<head>
<script>
function clickOnSmile() {
document.getElementById('message').innerHTML = "OK";
alert("OK");
}
</script>
</head>
<body>
<p style="height: 150px;"><a onclick="clickOnSmile();" style="background-image: url('Smile.png'); width: 150px; height: 150px;" name="smile" title="smile"></a> </p>
<p id="message"></p>
</body>
</html>
My cucumber (selenium code):
Alert alert = webDriver.switchTo().alert();
alert.dismiss();