• Post Reply Bookmark Topic Watch Topic
  • New Topic

Javascript error on Selenium IEdriver in windows xp ie8  RSS feed

 
biraj joshi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have built an application using jdk 6 and i m using selenium 2.40. My program successfully runs in windows 7 and 8 but when i try to run it in Windows xp it throws the following exception.

INFO: Retrying request
org.openqa.selenium.WebDriverException: JavaScript error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 46 milliseconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'DTA01-3F-ITD12', ip: '192.168.214.53', os.name: 'Windows XP'
, os.arch: 'x86', os.version: '5.1', java.version: '1.7.0_51'
Session ID: 3b9bdf76-9fc2-42ed-9010-24c4748bbe53
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0
, ignoreZoomSetting=true, enablePersistentHover=true, ie.ensureCleanSession=fals
e, browserName=internet explorer, enableElementCacheCleanup=true, unexpectedAler
tBehaviour=dismiss, version=8, ie.usePerProcessProxy=false, cssSelectorsEnabled=
true, ignoreProtectedModeSettings=true, requireWindowFocus=false, handlesAlerts=
true, initialBrowserUrl=https://www.himalremit.com/newpcregistration.php, ie.for
ceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserC
ommandLineSwitches=, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.
java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHa
ndler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.ja
va:573)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDri
ver.java:482)
at hbl.remit.com.Browser.main(Browser.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)

This is my code

DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability("ignoreProtectedModeSettings", true);
caps.setCapability("ignoreZoomSetting", true);
caps.setCapability("javascript.enabled", true);
caps.setCapability("initialBrowserUrl","https://www.gigle.com/preregistration.php");
WebDriver driver = new InternetExplorerDriver(caps);
driver.get("https://www.gigle.com/preregistration.php");
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("document.getElementsByName('caminfo').item(0).value = '"+regValue+"';");
jse.executeScript("document.getElementsByName('reqip').item(0).value = '"+ipAddr+"';");
jse.executeScript("document.getElementsByName('phyid').item(0).value = '"+PHYID+"';");
jse.executeScript("document.getElementsByName('hdid').item(0).value = '"+BIOSID+"';");

WebElement element = driver.findElement(By.name("Submit"));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", element);

Basically what it does is it submits above values in a form and submit the form.

The preregistration.php is this.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Himal Remit</title>
<script language = "JavaScript">
function setCount(target){
if(target == 0) document.f1.action="https://www.gigle.com/registration.php";
document.f1.submit();
}
</script>
</head>
<body>
<form action="" method="post" name="f1">
<input type="hidden" name="caminfo" value="" id="caminfo">
<input type="hidden" name="reqip" value="" id="reqip">
<input type="hidden" name="phyid" value="" id="phyid">
<input type="hidden" name="hdid" value="" id="hdid">
<input type="submit" name="Submit" hidefocus="true" style="height: 0px; width: 0px; border: none; padding: 0px;" onClick="setCount(0)">
</form>
</body>
</html>

Please help.
THanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!