Pop up handling through PhantomJs in Java

徘徊边缘 提交于 2019-12-12 03:54:06

问题


Hi, I have a html page as below and i need to handle pop up generated in it in phantomjs using java code.Please provide the solution code.

<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>

I tried with Unable to handle alert using phantomJS in Java and Github https://github.com/detro/ghostdriver/issues/500 but it is not fruitful.

来源:https://stackoverflow.com/questions/41503733/pop-up-handling-through-phantomjs-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!