3

I'm trying to create selenium tests for one site. In short, when a user opens the site, a CMS adds some dynamic elements (HTML + JS) to the page.

When I run tests on FF driver - all is OK.

FF Driver config:

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(CapabilityType.ELEMENT_SCROLL_BEHAVIOR,1);
return new FirefoxDriver(desiredCapabilities);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

Some page part, in this case.

driver.getPageSource()

http://pastebin.com/P3F6HsDP

As you can see, the dynamic block does exist.

But in the case of HtmlUnit:

HtmlUnitDriver htmlUnitDriver = new HtmlUnitDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

... the dynamic block doesn't exist: http://pastebin.com/b4iRGzjM

Can you please suggest how I can fix it or share some thoughts?

I tried:

  htmlUnitDriver.setJavascriptEnabled(true);

But I got the following error: http://pastebin.com/qRazGjGY

Andrew Regan
  • 5,087
  • 6
  • 37
  • 73
Java Dude
  • 454
  • 6
  • 24
  • Can you post the content of: http://localhost:8080/portal/master/_/asset/com.evry.app.onlineportal:1457035532/js/js-webshim/minified/shims/combos/3.js, please? – Andrew Regan Mar 03 '16 at 22:18
  • http://pastebin.com/Zhsk5Vu7 this is: https://afarkas.github.io/webshim – Java Dude Mar 03 '16 at 22:23
  • Having done a fair bit of searching of source trees I'd say this was an incompatibility between Webshim and the Rhino JS engine that is used by HtmlUnit - nothing at all to do with Selenium. I don't know why it can't find the `format` method of `Intl.DateTimeFormat`, but that's what the problem seems to be. Would probably need to create a dedicated test case for Rhino to prove this though... I'll edit tags to clarify. – Andrew Regan Mar 03 '16 at 22:40

1 Answers1

0

Have not fixed this. So, I've stared to use Remote Driver + PhantomJS. HTMLunit don't support all JS libs.

Java Dude
  • 454
  • 6
  • 24