1

I'm trying to interact with Selenium to Google Translate Website.

If I run the following code all works fine, but in the constructor if I want to enable the javascript it goes in exception. I searched for one hour in google but nothing helped me.

This works:

WebDriver driver = new HtmlUnitDriver();
driver.get("https://translate.google.it/");

This doesn't works:

WebDriver driver = new HtmlUnitDriver(true);
driver.get("https://translate.google.it/");

Exception:

Caused by: java.lang.RuntimeException: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot delete property "1" of undefined (https://translate.google.it/translate/releases/twsfe_w_20160822_RC00/r/js/desktop_module_main.js#16)

I think the problem is related to google translate website, because in another website it works, but I don't know how to "repair" this exception.

Can you help me please? Thanks Davide

Davide
  • 1,931
  • 2
  • 19
  • 39

1 Answers1

0

It could be problem of htmlunit rhino engine. Maybe make sense to switch to PhantomJS? HtmlUnitDriver (HtmlUnit) vs GhostDriver (PhantomJS)?

Community
  • 1
  • 1
unickq
  • 1,497
  • 12
  • 18