Error on compiling through ant - Hybrid Framework | Selenium Forum
D
Dinkesh Shah Posted on 05/01/2019

Hi,

I am getting error related to WebDriver wait when I compile through Ant. The line where I am getting the error is from the Generic Keywords class. When I have below lines in the getObject function I am getting the error:

// Wait till the element is visible
wait.until(ExpectedConditions.visibilityOf(element));

// Wait till the element is clickable
wait.until(ExpectedConditions.elementToBeClickable(element));

 

Below is the error

[echo] compiling...
[javac] F:\QTPSelenium\Rediff_Hybrid_Framework\build.xml:56: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 16 source files to F:\QTPSelenium\Rediff_Hybrid_Framework\build
[javac] F:\QTPSelenium\Rediff_Hybrid_Framework\src\main\java\com\hybrid\rediff\keywords\GenericKeywords.java:219: error: method until in class FluentWait<T> cannot be applied to given types;
[javac] wait.until(ExpectedConditions.visibilityOf(element));
[javac] ^
[javac] required: Function<? super WebDriver,V>
[javac] found: ExpectedCondition<WebElement>
[javac] reason: cannot infer type-variable(s) V
[javac] (argument mismatch; ExpectedCondition<WebElement> cannot be converted to Function<? super WebDriver,V>)
[javac] where V,T are type-variables:
[javac] V extends Object declared in method <V>until(Function<? super T,V>)
[javac] T extends Object declared in class FluentWait
[javac] F:\QTPSelenium\Rediff_Hybrid_Framework\src\main\java\com\hybrid\rediff\keywords\GenericKeywords.java:222: error: method until in class FluentWait<T> cannot be applied to given types;
[javac] wait.until(ExpectedConditions.elementToBeClickable(element));
[javac] ^
[javac] required: Function<? super WebDriver,V>
[javac] found: ExpectedCondition<WebElement>
[javac] reason: cannot infer type-variable(s) V
[javac] (argument mismatch; ExpectedCondition<WebElement> cannot be converted to Function<? super WebDriver,V>)
[javac] where V,T are type-variables:
[javac] V extends Object declared in method <V>until(Function<? super T,V>)
[javac] T extends Object declared in class FluentWait
[javac] 2 errors

 

---------------------------------------------

If I remove those wait related lines from my code, the error is gone.

Can you please let me know what is happening here.

Regards,

Dinkesh


A
Ashish Thakur Replied on 06/01/2019

includeantruntime = false

You have to set this in the build.xml in javac section of compile target


D
Dinkesh Shah Replied on 06/01/2019

Still getting the same error on compile.

Below is the xml data

<!-- compile -->
<target name="compile" depends="init, clean">
<delete includeemptydirs="true" quiet="true">
<fileset dir="${test.dest}" includes="**/*" />
</delete>
<echo message="making directory..." />
<mkdir dir="${test.dest}" />
<echo message="classpath------: ${test.classpath}" />
<echo message="compiling..." />
<javac debug="true" destdir="${test.dest}" srcdir="${test.src}" target="1.8" classpath="${test.classpath}" includeantruntime="false">
</javac>
</target>


A
Ashish Thakur Replied on 09/01/2019

Which selenium version are you using?


D
Dinkesh Shah Replied on 12/01/2019

Currently I am using 3.141.59. Earlier I was using 3.14.0

Both the versions are giving me the same error.


A
Ashish Thakur Replied on 13/01/2019

Please use this dependency in pom.xml

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>

 

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>


D
Dinkesh Shah Replied on 13/01/2019

Still getting the same error :(


A
Abhishek Replied on 14/01/2019

Please share your project in zip file.


D
Dinkesh Shah Replied on 14/01/2019

sure. Please find the attached.


D
Dinkesh Shah Replied on 14/01/2019

Nevermind. It has started to work again. The solution was given in the module 24 second last video in which you deleted all the files from the repository and recompile using maven.


D
Dinkesh Shah Replied on 20/01/2019

Please close this ticket.