[英]While using Selelnium, i'm getting an error
I downloaded the standalone server file, the driver file, then copied to the Library. 我下载了独立服务器文件,驱动程序文件,然后复制到库中。 I already moved the "lib" folder in the selenium file to the Library location also. 我已经将selenium文件中的“lib”文件夹移动到了Library位置。 Here's the code 这是代码
package google.search;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
public class GoogleSearch {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Create a new WebDriver object (Firefox browser)
WebDriver bot = new HtmlUnitDriver();
// Navigating to google.com
bot.get("http://www.google.com");
// Find the text input element by its name
WebElement inputField = bot.findElement(By.name("q"));
// Send some keys into the textfield
inputField.sendKeys("Selenium is easy");
// Submit your text (to start a google search)
inputField.submit();
// Saving the page source code into a string
String pageSource = bot.getPageSource();
//Closing the Firefox browser and "shutdown" the WebDriver object
bot.quit();
}
}
Even now that I get no red error indicators, I still get this weird error that I never encountered before. 即使现在我没有得到红色错误指示器,我仍然得到我之前从未遇到的这个奇怪的错误。 can someone tell me what this means? 谁能告诉我这意味着什么?
Feb 21, 2015 1:02:49 AM com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement addBehavior
WARNING: Unimplemented behavior: #default#userdata
You can add BrowserVersion class object for an HtmlUnitDriver to remove this error as 您可以为HtmlUnitDriver添加BrowserVersion类对象以删除此错误
WebDriver driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_24);
The object name can be replaced by different respective names.This is also different than creating a browser specific driver eg FirefoxDriver() 对象名称可以用不同的名称替换。这也与创建浏览器特定的驱动程序不同,例如FirefoxDriver()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.