通过Java中的PhantomJs弹出处理

时间:2017-01-06 10:31:32

标签: javascript java html selenium-webdriver phantomjs

  

嗨,我有一个html页面,如下所示,我需要处理使用java代码在phantomjs中生成的弹出窗口。请提供解决方案代码。

<html> 
<body> 

Card Number: 
<br> 
<input type="text" name="Card Number" value=""> 
<br> 
Card Holder Name: 
<br> 
<input type="text" name="Card Holder Name" value=""> 
<br><br> 
CVV: 
<br> 
<input type="text" name="CVV" value=""> 
<br> 
<br> 
<input type="button" value="proceed" onclick="myFunction()"> 

<script> 
function myFunction() { 
var x; 
if (confirm("Would you like to proceed payment!") == true) { 
x = "You pressed OK!"; 
} else { 
x = "You pressed Cancel!"; 
} 
document.getElementById("demo").innerHTML = x; 
} 
</script> 



</body> 
</html>
  

我尝试使用Unable to handle alert using phantomJS in Java和Github https://github.com/detro/ghostdriver/issues/500,但这并不富有成效。

0 个答案:

没有答案