Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
phantomjs webdriver上未显示javascript警报(java+;selenium)_Javascript_Java_Selenium_Phantomjs - Fatal编程技术网

phantomjs webdriver上未显示javascript警报(java+;selenium)

phantomjs webdriver上未显示javascript警报(java+;selenium),javascript,java,selenium,phantomjs,Javascript,Java,Selenium,Phantomjs,我点击Smile.png=> 我使用selenium进行UX测试。在chrome web驱动程序上,会显示带有“OK”消息的javascript警报,我的cucumber代码会关闭此javascript警报我的问题是phantomJS web驱动程序:带有“OK”消息的javascript警报未显示,我的cucumber代码有错误(org.openqa.selenium.unsupportedCommand异常:无效命令方法) …@Moshisho,我不希望selenium打开javascrip

我点击Smile.png=>

我使用selenium进行UX测试。在chrome web驱动程序上,会显示带有“OK”消息的javascript警报,我的cucumber代码会关闭此javascript警报我的问题是phantomJS web驱动程序:带有“OK”消息的javascript警报未显示,我的cucumber代码有错误(org.openqa.selenium.unsupportedCommand异常:无效命令方法)


…@Moshisho,我不希望selenium打开javascript警报。我想点击mysmile.png(这是我的目标应用程序,通过javascript执行警报(“OK”)。在chome上可以,但在phantom webdriver上不行。
<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>
Alert alert = webDriver.switchTo().alert();
alert.dismiss();