My invocation looks like this :
DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
capabilities.setBrowserName("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20160101 Firefox/66.0");
driver = new CustomHtmlUnitDriver(capabilities);
driver.setJavascriptEnabled(true);
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
driver.manage().timeouts().setScriptTimeout(3, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
driver.get(urlString);
#exception in line below
docString = driver.findElement(By.xpath("//*")).getAttribute("innerHTML");
My Maven dependencies are as follows
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>com.syncthemall</groupId>
<artifactId>boilerpipe</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.23.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlcleaner</groupId>
<artifactId>htmlcleaner</artifactId>
<version>2.17</version>
</dependency>
The exception am getting is
java.lang.NoSuchMethodError: org.apache.commons.lang3.StringEscapeUtils.escapeXml10(Ljava/lang/String;)Ljava/lang/String;
at com.gargoylesoftware.htmlunit.html.HtmlTextArea.printXml(HtmlTextArea.java:444)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.printChildrenAsXml(DomNode.java:843)
at com.gargoylesoftware.htmlunit.html.DomElement.printXml(DomElement.java:199)
at com.gargoylesoftware.htmlunit.html.DomNode.asXml(DomNode.java:816)
at org.openqa.selenium.htmlunit.HtmlUnitWebElement.getAttribute(HtmlUnitWebElement.java:411)
at com.snaprapid.snapscraper.services.scraper.helpers.DynamicWebScrapperHelper.getPageSource(DynamicWebScrapperHelper.java:24)
I tried excluding xml-apis from org.apache.poi dependency and adding an older version of xml-apis to my dependency, as suggested in one of the git issues but is not working properly for me. It would be of great help if anyone could point out where am wrong. Thank you in advance