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
Instructor
Ashish Thakur Replied on 06/01/2019
includeantruntime = false
You have to set this in the build.xml in javac section of compile target
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>
Instructor
Ashish Thakur Replied on 09/01/2019
Which selenium version are you using?
Currently I am using 3.141.59. Earlier I was using 3.14.0
Both the versions are giving me the same error.
Instructor
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>
Still getting the same error :(
Please share your project in zip file.
sure. Please find the attached.
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.
Please close this ticket.