简体   繁体   中英

Bad input type: “email”, creating a text input error when use HtmlUnitDriver

I am login into google plus using selenium htmlunit driver. below code is working fine with fireFox driver. When I use HtmlUnitDriver, it gives some error like " Bad input type: "

HtmlUnitDriver driver = new HtmlUnitDriver(true);
driver.setJavascriptEnabled(true);
driver.get("https://plus.google.com");
driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
driver.findElement(By.id("Email")).sendKeys("hjhj@gmail.com");
driver.findElement(By.id("next")).click();
driver.findElement(By.id("Passwd")).sendKeys("qwert");
driver.findElement(By.id("signIn")).click();
driver.manage().timeouts().implicitlyWait(1, TimeUnit.MILLISECONDS);

can anyone tell me how I can achieve this?

From trying your code I saw a message that matched your description.

Mar 01, 2016 11:39:28 AM    com.gargoylesoftware.htmlunit.html.InputElementFactory createElementNS
INFO: Bad input type: "email", creating a text input

HtmlUnit likes to fill the console up with logging, if you add these lines

java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF); 
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");

In the static or main it will turn of the logging from htmlunit (or see this question )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM