在selenium webdriver中使用JavascriptExecutor时非法的chracter异常

我正在使用Selenium webdriver(2.37.0)来自动化一个Web表单 . 使用JavascriptExecutor在select选项中设置某个值,如下所示:

if (driver instanceof JavascriptExecutor)
 {

    js = (JavascriptExecutor)driver;
 }

    js.executeScript("document.getElementById('ddlRegCategory').value = 'XYZ';​​​​​​​​​​");

我在上面的脚本行上得到了非法字符异常 .

org.openqa.selenium.WebDriverException:非法字符

命令持续时间或超时:25毫秒构建信息:版本:'2.37.0',修订版:'a7c61cb',时间:'2013-10-18 17:14:00'系统信息:主机:'mitalee-PC',ip :'169.254.147.196',os.name:'Windows 7',os.arch:'x86',os.version:'6.1',java.version:'1.7.0'会话ID:b98a4393-d1eb-4f21- 93bd-87248e58228b驱动程序信息:org.openqa.selenium.firefox.FirefoxDriver能力[{平台= XP,acceptSslCerts = TRUE,javascriptEnabled = TRUE,browserName =火狐,旋转=假,locationContextEnabled = TRUE,版本= 26.0,cssSelectorsEnabled = TRUE, databaseEnabled =真,handlesAlerts =真,browserConnectionEnabled =真,nativeEvents =真,webStorageEnabled =真,applicationCacheEnabled =真,takesScreenshot =真}]在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)在sun.reflect.NativeConstructorAccessorImpl.newInstance(来自java.lang.reflect.Constructor.newInstance(未知来源)的sun.reflect.DelegatingConstructorAccessorImpl.newInstance(未知来源)的未知来源org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)在org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)在org.openqa.selenium.remote.RemoteWebDriver.execute( RemoteWebDriver.java:554)在org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:463)在HRMS.main(HRMS.java:39)产生的原因:org.openqa.selenium.remote.ErrorHandler $ UnknownServerException :非法人物

回答(0)