0
使用Seleneium 2.25時,出現了很多問題。Selenium使用JavaScript或獲取元素時出錯
我想從我的電腦(本地/客戶端)在遠程計算機(服務器)上使用Selenium遠程驅動程序。然而,當我嘗試使用DesiresCapabilities.Htmlunit()它會找到元素,但它說它們不可見。我完全被這個難住了。我不確定爲什麼可以找到它,但不可見。
那麼我試着用一些JavaScript來強制它。它返回並拋出一個錯誤,指出網頁在加載頁面之前無法執行JavaScript。當我做了一個暗含的等待並且發現了它正在等待的元素時,這怎麼可能?
DesiredCapabilities iecapa = DesiredCapabilities.HtmlUnit();
iecapa.IsJavaScriptEnabled = true;
driver = new RemoteWebDriver(new Uri("http://<IP of server>:4444/wd/hub"), iecapa);
IJavaScriptExecutor jQuery = ((IJavaScriptExecutor)(driver));
addressElement = (IWebElement)jQuery.ExecuteScript("return document.GetElementByName('searchAddress')");
所以,如果任何人想要幫助我,將不勝感激!謝謝!
http://imageshack.us/photo/my-images/163/seleniumhtmluniterror.jpg/
那就是錯誤。 StackOverflow不會讓我發佈在這裏。 =(