Work with java client driver selenium not execute javascript events.
Steps to reproduse:
1. Create html page with code:
[code=html]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>
Untitle
</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script src="console.js" language="javascript" type="text/javascript"></script>
</head>
<body>
<form id="form" name="form" style="display:inline;">
<input type="hidden" id="actionName" name="actionName" value=""/>
<input type="button" onclick=" showpopuppage(); " value="Start"/>
</form>
<!-- popup b -->
<div id="divcontainer" class="messagediv">
</div>
<div id="divContent" class="messageDivContent">
<input type="hidden" id="refreshAfterClose" value="false">
<input type="button" value="Close" onClick="closepopuppage();"/>
</div>
<!-- popup e -->
</body>
</html>
[/code]
2. Create javasript file
[code = js]
// JavaScript Document
function showpopup(div_id){
var tp = document.getElementById(div_id);
tp.style.visibility = tp.style.visibility=='visible'?'hidden':'visible';
}
function showpopuppage(){
var overpage = document.getElementById('divcontainer');
var divContent = document.getElementById('divContent');
var docwidth = 0;
var docheight = 0;
var popupwidth = 800;
var popupheight = 600;
var toppos = 0;
document.getElementById("divcontainer").style.backgroundColor = "#FF00FF";
// setting popup top / left
divContent.style.top = 100;
divContent.style.left = 100;
// setting popup header width / height
divContent.style.width = popupwidth;
divContent.style.height = popupheight;
// Showing popup
overpage.style.display = "block";
//container.style.display = "block";
divContent.style.display = "block";
divContent.style.background = "#CC99CC";
}
function closepopuppage(fromInnerCloseButton){
var overpage = window.top.document.getElementById('divcontainer');
var divContent = window.top.document.getElementById('divContent');
divContent.style.display = "none";
overpage.style.display = "none";
}
[/code]
3. Create CSS file
[code=CSS]
/* CSS Document */
body {
margin: 0px;
background-color: #FFFFFF;
font-family: Arial, Helvetica, sans-serif;
font-size: 9pt;
color: #333333;
}
.messagediv{
width: 100%;
height: 100%;
display: none;
position:absolute;
top: 0px;
left: 0px;
background: transparent;
opacity: 9.99;
visibility: hidden;
}
.messageDivContent {
position: absolute;
display: none;
}
[/code]
4. Create TestCase file
[code=java]
package test;
import com.thoughtworks.selenium.*;
import junit.framework.*;
public class PopUpTest extends TestCase {
private Selenium browser;
public void setUp() {
browser = new DefaultSelenium("localhost",
4444, "*iexplore", "
http://localhost");
browser.start();
}
public void testGoogle() {
browser.open("/popup/index.html");
browser.click("//input[@value='Start']");
browser.click("//input[@value='Close']");
}
public void tearDown() {
// browser.stop();
}
}
[/code]
5. Run selenium server
6. Execute TestCase file
Result: PopUp not close and javascript log about error on page