0

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();
Stéphane GRILLON
  • 11,140
  • 10
  • 85
  • 154
  • [This might help](http://stackoverflow.com/a/30371503/2470092)... – Moshisho Jan 05 '17 at 17:45
  • @Moshisho, I do not want open javascript alert by selenium. I want click on my smile.png (and it is my target application that exec alert("OK") by javascript). On chome is OK but not with phantom webdriver. – Stéphane GRILLON Jan 06 '17 at 08:34

0 Answers0