Error in Module 23 | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos

Selenium Training Forum

Error in Module 23

R
ramu.gande Post on 31/10/2018

showing error on this line in Xls Reader file

XSSFHyperlink link = createHelper.createHyperlink(XSSFHyperlink.LINK_FILE);



SKIPPED: testB
java.lang.RuntimeException: java.lang.Error: Unresolved compilation problems:
The type org.apache.poi.common.usermodel.HyperlinkType cannot be resolved. It is indirectly referenced from required .class files
Type mismatch: cannot convert from Hyperlink to XSSFHyperlink

at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:143)
at org.testng.internal.Parameters.handleParameters(Parameters.java:426)
at org.testng.internal.Invoker.handleParameters(Invoker.java:1383)
at org.testng.internal.Invoker.createParameters(Invoker.java:1075)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1180)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.lang.Error: Unresolved compilation problems:
The type org.apache.poi.common.usermodel.HyperlinkType cannot be resolved. It is indirectly referenced from required .class files
Type mismatch: cannot convert from Hyperlink to XSSFHyperlink

at core.ddf.testcases.Xls_Reader.<init>(Xls_Reader.java:283)
at core.ddf.testcases.DummyTestB.getData(DummyTestB.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:117)
... 20 more


===============================================
Default test
Tests run: 1, Failures: 0, Skips: 1
===============================================


===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

[TestNG] Time taken by org.testng.reporters.XMLReporter@3a03464: 16 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@3f2a3a5: 109 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@77b52d12: 59 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter@67b6d4ae: 15 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 0 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@3cbbc1e0: 16 ms



Please Help
Thank you
Ramu

A

Instructor

Ashish Thakur Reply on 01/11/2018

You need to include POI api jar files
In your java project, its explained how to include the poi api jars

R
ramu.gande Reply on 02/11/2018

Hi Ashish,

Since it is Maven project,i have all poi api jars downloaded,I couldn't find POM.xml ,i just made the file by copying dependencies.

i can see all the jars in my libraries,

here i am attaching pom.xml
please tell me if i am missing any 





<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>core.ddf</groupId>
<artifactId>DataDriven_Core_Framework</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>DataDriven_Core_Framework</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans -->
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.40.2</version>
</dependency>




<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.13.0</version>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>

</dependencies>
</project>

i am attaching screen for your refrence.
thank you,
Ramu

R
ramu.gande Reply on 02/11/2018

is it because of POI 3.7?when i used xls reader with poi 3.6 it is working fine ,i am not able to compile the project by changing it to poi 3.6 its giving me build failure.

please help
thank you
Ramu

A

Instructor

Ashish Thakur Reply on 07/11/2018

Thats Great