我的selenium脚本返回一条错误消息,指出找不到对象。任何人都可以确定我哪里出错了吗?
错误讯息: com.thoughtworks.selenium.SeleniumException:错误:引发异常:document.slObject未定义
页面的html代码是
<div id="silverlightControlHost" style="width: 720px; height: 520px;"><object id="slObject" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"><param name="source" value="/samplesbrowser/ClientBin/Infragistics.Web.SLDV.xap" /><param name="splashscreensource" value="splash.xaml" /><param name="onsourcedownloadprogresschanged" value="onSourceDownloadProgressChanged" /><param name="onsourcedownloadcomplete" value="onSourceDownloadComplete" /><param name="onError" value="onSilverlightError" /><param name="background" value="white" /><param name="minRuntimeVersion" value="4.0.50826.0" /><param name="windowless" value="false" /><param name="autoUpgrade" value="true" /><param name="culture" value="en-US" /><param name="uiculture" value="en-US" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration: none"><img id="fallbackImage" src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style: none; width: 100%; height: 100%;" /></a></object><iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px;border: 0px"></iframe></div>
我的硒代码剪断如下:
@Test
public void testPocAddCustomerHover() throws Exception {
selenium.open(URL);
//Thread.sleep(10000);
silverLightApp = new Silvernium(selenium, "slObject");
selenium.windowMaximize();
assertEquals(100, silverLightApp.actualWidth());
}