java:package org.openqa.selenium.html5 does not exist - java

I'm using selenium for UI testing in java.
I have a module cloned from git hub which is being used in my project.
In spite of having the latest jar dependencies in my build.gradle file(intelliJ), I'm encountering
package org.openqa.selenium.html5 not found error
Only during runtime.
The selenium dependency does not complain at compile time, but during run time I am having errors that say
java:package org.openqa.selenium.logging does not exist
java:package org.openqa.selenium.remote does not exist
java:package org.openqa.selenium.support.ui does not exist
java:package org.openqa.selenium does not exist
I try clearing my gradle cache and re-installing the jars with the latest versions, and yet it's still the same issue.
These are the dependencies I have for selenium in my project:
implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.0.0-alpha-2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-server', version: '4.0.0-alpha-2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-api', version: '4.0.0-alpha-2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-support', version: '4.0.0-alpha-2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-remote-driver', version: '4.0.0-alpha-2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-chrome-driver', version: '4.0.0-alpha-2'
I also tried with different versions of selenium, but nothing works.
Any solutions that I could try to fix this issue.
Or am I missing something?

Related

Old javax libraries compatibility with jakarta

I updated my java project with the latest Java JDK and Tomcat 10. The new libraries use jakarta and you need to rename all your javax. to jakarta...
The libraries included in gradle are:
compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '5.0.0'
compileOnly group: 'jakarta.servlet.jsp', name: 'jakarta.servlet.jsp-api', version: '3.0.0'
compileOnly group: 'jakarta.el', name: 'jakarta.el-api', version: '4.0.0'
compileOnly group: 'jakarta.websocket', name: 'jakarta.websocket-api', version: '2.0.0'
compileOnly group: 'jakarta.security.enterprise', name: 'jakarta.security.enterprise-api', version: '2.0.0'
implementation group: 'jakarta.servlet.jsp.jstl', name: 'jakarta.servlet.jsp.jstl-api', version: '2.0.0'
implementation group: 'org.glassfish.web', name: 'jakarta.servlet.jsp.jstl', version: '2.0.0'
But I found I couldnt use Sitemesh and Htmlcompressor libraries anymore because they use old javax. library. If I include javax. libraries:
compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
I get java.lang.NoClassDefFoundError errors.
Is there a way to have compatibility with the old libraries?
Include both the old and the new libraries? Since there are two different namespaces, they might be able to live together. If it works, it should be enough as a transitory solution before everybody migrates to jakarta.

I get a error: java.lang.NoClassDefFoundError

I need help. My dependency is following:
compile group: 'org.springframework.cloud', name: 'spring-cloud-stream-binder-kinesis', version: '2.0.1.RELEASE'
compile group: 'org.springframework', name: 'spring-web', version: '3.0.2.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework:spring-context-support'
I get the error:
java.lang.NoClassDefFoundError: org/springframework/web/context/support/StandardServletEnvironment
Is there something wrong with my dependency?
it's in spring-web, which is a dependency of spring-boot-starter-web. Here you've overridden spring-web with a very old Spring Framework version. That's the source of your problem.

Android studio not cleaning dependencies after Gradle clean

I am trying to use deeplearning4j on Android device, switching between debugging on emulator and physical device.
For this I have multiple dependencies that are of a huge size and are all necessary. Thankfully, there is an implementation for each platform provided by org.bytedeco.
So targeting Android arm-64 which are the most common I omited other platforms like
// implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta6', classifier: "android-x86_64" //for emulator
.
Wanted dependencies are like:
implementation (group: 'org.deeplearning4j', name: 'deeplearning4j-core', version: '1.0.0-beta7') {
exclude group: 'org.bytedeco', module: 'opencv-platform'
exclude group: 'org.bytedeco', module: 'leptonica-platform'
exclude group: 'org.bytedeco', module: 'hdf5-platform'
}
implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta7'
implementation group: 'org.bytedeco', name: 'openblas', version: '0.3.9-1.5.3'
implementation group: 'org.bytedeco', name: 'opencv', version: '4.3.0-1.5.3'
implementation group: 'org.bytedeco', name: 'leptonica', version: '1.79.0-1.5.3'
implementation group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta7', classifier: "android-arm64"
implementation group: 'org.bytedeco', name: 'openblas', version: '0.3.9-1.5.3', classifier: "android-arm64"
implementation group: 'org.bytedeco', name: 'opencv', version: '4.3.0-1.5.3', classifier: "android-arm64"
implementation group: 'org.bytedeco', name: 'leptonica', version: '1.79.0-1.5.3', classifier: "android-arm64"
The problem is, when I build or clean and build the output Jar is huge, it is more than 800 mb, and if I see the tree of dependencies, I always see other platforms jars in path like:
I know that not all of these are necessary, because at one point in time (and I couldn't reproduce what was present and what I aim for again) I had not all of these dependencies. The exported APK was around 400 mb.
So what's up with the Windows, Linux, dependencies...
Sync project and Gradle clean Gradle build do nothing to these, exporting APK as well. Always an APK of > 800mb
Edit:
Please do not pay attention to versions mismatch between different dependencies and API and implementations. I am switching between versions dl4j beta6, dl4j beta7 and others

Gradle uses latest version of TestNG instead of declared version

In my gradle script I have following dependencies:
dependencies {
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version:'3.9.1'
compile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '2.2.4'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.6.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.6.2'
compile group: 'org.uncommons', name: 'reportng', version:'1.1.4'
compile group: 'com.google.inject', name: 'guice', version:'4.0'
compile group: 'org.apache.commons', name:'commons-math3', version: '3.6.1'
testCompile group: 'org.testng', name: 'testng', version:'6.14.3'
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.25'}
As seen here I ask to use 6.14.3 as the testng version. Only when I try to run my script I get the issue:
Execution failed for task ':compileJava'.
I first checked if the Java version is correct, but no issues there. Only if i run gradle --debug. I found that testng jar downloaded was of version 7.0.0-beta4. But as I did not declare this I'm not sure why this is used or I can force to use the correct one?
Running ./gradlew dependencies should show you the following compile dependencies (amongst many others):
…
+--- org.uncommons:reportng:1.1.4
| +--- org.testng:testng:[5.0,) -> 7.0.0-beta6
| \--- velocity:velocity:1.4
| \--- velocity:velocity-dep:1.4
…
In other words, your declared compile dependency on org.uncommons:reportng:1.1.4 has a transitive dependency on TestNG which Gradle resolves to the latest TestNG version – since you don’t explicitly declare any other TestNG dependency for the compile configuration. Note that you only directly depend on TestNG from the testCompile configuration!
You should be able to fix this by changing your TestNG dependency declaration as follows:
compile group: 'org.testng', name: 'testng', version:'6.14.3'

Problems with gradle dependencies and apache POI - CellType

I am relatively new to using gradle, and am having trouble understanding dependencies. I have been using the Apache POI library to read from excel for a project, and initially I downloaded the JARs into my project and it worked completely fine. I decided to use gradle dependencies when I put my project on GitLab (from what I understand it is the same as using JARs but better when sharing the project since you don't have to download them?). This worked for most of the imports; however, for some reason my project is no longer able to import CellType. I redownloaded the JARs for the time being and it works again.
A summary of the question(s):
Why is CellType the only thing that stopped working, and why did it stop working? What is different about it?
Edit: here is the dependencies section from my build.gradle
compile 'com.google.apis:google-api-services-sheets:v4-rev499-1.23.0'
testCompile group: 'org.testng', name: 'testng', version: '6.9.10'
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.8.1'
// https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-java6
compile group: 'com.google.oauth-client', name: 'google-oauth-client-java6', version: '1.11.0-beta'
// https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-jetty
compile group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.11.0-beta'
// https://mvnrepository.com/artifact/org.apache.poi/poi
compile group: 'org.apache.poi', name: 'poi', version: '3.9'
// https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.9'
// https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.17'
// https://mvnrepository.com/artifact/org.apache.commons/commons-collections4
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
(Sorry for the messiness :/ )
The compile error I was getting was something like "cannot resolve" (the import statement was turning red)
import org.apache.poi.ss.usermodel.CellType;

Categories