ERROR FIREFOX IN SELENIUM 3 - selenium

[i have added gecko driver to system.set property, but still its not launching]
java.lang.NoSuchMethodError: org.openqa.selenium.net.PortProber.waitForPortUp(IILjava/util/concurrent/TimeUnit;)V

I was getting the same error. When I debug my application, I found that it was referring the old Selenium jar. To resolve this, I removed the old jar's and rebuild the project with Selenium 3 jars.
Ensure that you have right libraries added to your project.
Hope this helps.

In my case I got similar issue when I added dependency to phantomdriver to my project pom. Selenium 3.0 got it own dependency to phantomdriver already, which produced dependency conflict and not allows to geckodriver to be started. Solution was to remove additional dependency to phantomdriver.

Hridesh Gupta & user3153853, guys, your answers helped me A LOT! Thanks!
So I had the same issue, FF was not launching returning an exception:
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
...
enter code hereCaused by: java.lang.NoSuchMethodError: org.openqa.selenium.net.PortProber.waitForPortUp(IILjava/util/concurrent/TimeUnit;)
...
It turned out the same thing - dependencies collision.
I had:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.1</version>
</dependency>
and I added this:
<dependency>
<groupId>ru.yandex.qatools.ashot</groupId>
<artifactId>ashot</artifactId>
<version>1.5.3</version>
</dependency>
Apparently,
<version>1.5.3</version>
was not compatible with
<version>3.0.1</version>
so by reducing Ashot's version down to
<version>1.5.2</version>
I fixed FF issue.

Related

Got following error when try to execute first script to open web url with help of gecko driver -

Code is as below:
package nw;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class test {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","C:\\geckodriver-v0.24.0-win64.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.shop.demoqa.com");
}
}
Hello i am facing this issue in selenium while launching the above given program --
program..plz help me
com/google/common/collect/ImmutableMap
at org.openqa.selenium.firefox.FirefoxDriver.<clinit>(FirefoxDriver.java:108)
at nw.test.main(test.java:14)
Caused by: java.lang.ClassNotFoundException:
com.google.common.collect.ImmutableMap
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
You have not added selenium-server.jar in your build or dependency in your POM.
You have added selenium-java.jar in your build or as dependency due to which your code is compiling fine
You need to add that too
Download jar from below location:
https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server
OR add below dependency
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.141.59</version>
</dependency>
Note that here I am using version 3.141.59 for server so your selenium java jar should of same version to prevent from any unrelated error
Selenium relies on Google Guava and your test is failing to find ImmutableMap class.
The solution is to add the relevant version of guava to your project classpath.
The full set of dependencies would be:
animal-sniffer-annotations-1.14.jar
byte-buddy-1.8.15.jar
checker-compat-qual-2.0.0.jar
commons-exec-1.3.jar
error_prone_annotations-2.1.3.jar
guava-25.0-jre.jar
j2objc-annotations-1.1.jar
jsr305-1.3.9.jar
okhttp-3.11.0.jar
okio-1.14.0.jar
selenium-api-3.141.59.jar
selenium-chrome-driver-3.141.59.jar
selenium-edge-driver-3.141.59.jar
selenium-firefox-driver-3.141.59.jar
selenium-ie-driver-3.141.59.jar
selenium-java-3.141.59.jar
selenium-opera-driver-3.141.59.jar
selenium-remote-driver-3.141.59.jar
selenium-safari-driver-3.141.59.jar
selenium-support-3.141.59.jar
Going forward I would recommend using a dependency management solution like Maven or Gradle so you won't have to manually download the .jars. Check out Selenium with Java article for comprehensive explanation and example code snippets.

NoSuchMethodError: org.apache.http.conn.ssl.SSLConnectionSocketFactory

I keep getting:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLConnectionSocketFactory.<init>(Ljavax/net/ssl/SSLContext;Ljavax/net/ssl/HostnameVerifier;)V
at com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.<init>(SdkTLSSocketFactory.java:56)
at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.getPreferredSocketFactory(ApacheConnectionManagerFactory.java:87)
at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.create(ApacheConnectionManagerFactory.java:65)
at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.create(ApacheConnectionManagerFactory.java:58)
at com.amazonaws.http.apache.client.impl.ApacheHttpClientFactory.create(ApacheHttpClientFactory.java:50)
at com.amazonaws.http.apache.client.impl.ApacheHttpClientFactory.create(ApacheHttpClientFactory.java:38)
at com.amazonaws.http.AmazonHttpClient.<init>(AmazonHttpClient.java:253)
at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:145)
at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:136)
at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:121)
at com.amazonaws.services.elasticmapreduce.AmazonElasticMapReduceClient.<init>(AmazonElasticMapReduceClient.java:175)
at com.amazonaws.services.elasticmapreduce.AmazonElasticMapReduceClient.<init>(AmazonElasticMapReduceClient.java:155)
at ExtractRelatedPairs.main(ExtractRelatedPairs.java:30)
Visual description which illustrates all the added jars (on the left) and their version for inspection.
Despite the fact that all needed jars are added, tried all the different jars and versions, even tried to change project's settings to work with 1.6 1.7 instead of 1.8...
Any ideas?
Assuming your project is built with Maven, adding this to your pom.xml should take care of that issue:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>

IntelliJ Idea groovy.lang.GroovyRuntimeException: Conflicting module versions

My maven builds are fine and able to run groovy from cli. However if I try to run my groovy class inside IntelliJ Idea (version 15 community edition), its gives me below error.
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:61)
at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
at groovy.lang.Closure.<init>(Closure.java:219)
at groovy.lang.Closure.<init>(Closure.java:236)
at groovy.lang.Closure$1.<init>(Closure.java:203)
at groovy.lang.Closure.<clinit>(Closure.java:203)
at filter.App.<clinit>(App.groovy)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.3.9 and you are trying to load version 2.4.5
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:509)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:77)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:71)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:53)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:110)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:71)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:33)
... 10 more
Not sure how to get rid of this.
This is my pom dependency.
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.5</version>
</dependency>
And I am using spring boot.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
<relativePath></relativePath>
</parent>
This is my groovy version installed in system.
Groovy Version: 2.4.5 JVM: 1.8.0_60 Vendor: Oracle Corporation OS: Linux
Please let me know if someone knows about this.
you have to delete groovy lib from project settings.
shift+alt+ctrl + s, global libraries - delete groovy. And when trying to run applictaion / test you should have point to groovy from maven dependencies.
#SuperAndrew's suggestion wasn't my situation -- I didn't have Groovy registered under Global Libraries under my Project Structure. But I did find this StackExchange solution resolved my issue. Add this code to your build.gradle file.
configurations.all {
resolutionStrategy {
force 'org.codehaus.groovy:groovy-all:2.4.4'
}
}
I was seeing this in a recent project after I upgraded Gradle to 7.+
The reason this was causing a problem for me was that Gradle 7.+ is now using Groovy 3.+ and as such various other plugins needed to be upgraded (e.g. spock-core).
It was this incompatibility of various dependencies that were causing this and once I updated all of them this issue went away.

Plugin works on Jira 5.2.10, but does not on 6.0

Made plugin for Jira with data exchange via servlet (using FileUploadServlet).
Testing on Jira 5.2.10 was OK, but on 6.0 there is a trouble:
2013-06-27 21:46:26,575 http-bio-8080-exec-24 ERROR anri 1306x1054x1 4bhuqg 169.254.57.250 /plugins/servlet/smartActDataServlet [atlassian.plugin.module.PrefixDelegatingModuleFactory] Detected an error (NoClassDefFoundError) instantiating the module for plugin 'com.polontech.jira.plugin.activity.smartact.SmartAct' for module 'dataServlet': org/apache/commons/fileupload/FileUploadException. This error is usually caused by your plugin using a imported component class that itself relies on other packages in the product. You can probably fix this by adding the missing class's package to your instructions; for more details on how to fix this, see https://developer.atlassian.com/display/DOCS/NoClassDefFoundError .
2013-06-27 21:46:26,577 http-bio-8080-exec-24 ERROR anri 1306x1054x1 4bhuqg 169.254.57.250 /plugins/servlet/smartActDataServlet [atlassian.plugin.servlet.DefaultServletModuleManager] Unable to create servlet
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException
Why? What's the difference between 5.2.10 and 6.0? How to solve the problem?
As I get, problem is with FileUpload. Maybe, there is a way to add this to my project?
dependencies are on their place:
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
Error seems very vague. We cannot know what the difference is but as with every software product things change between versions and stuff works, breaks or is deprecated.
Go to the Atlassian Support and Answers sites and get the answer you're looking for from the guys that develop JIRA.They'll know how to help.
Also review all the information on https://developer.atlassian.com/display/JIRADEV/Preparing+for+JIRA+6.0
since 6.0 is a major release
Problem solved. Just check the version of all dependencies: I had to use common-fileupload-1.2.2:
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>

How to add struts-layout.jar entry in pom.xml

i am trying to deploy struts 1.3 based application using maven.
I want to add Struts-Layout.jar entry in pom.xml.
after goggling i got this answer to add following entry in pom.xml:
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>Struts-Layout</artifactId>
<version>1.3</version>
</dependency>
But it gives this error :
[ERROR] Failed to execute goal on project sample: Could not resolve depe
ndencies for project com.sample.cms:sample:war:1.1.32: Failure to find o
rg.apache.struts:Struts-Layout:jar:1.3 in http://maven.springframework.org/exter
nal was cached in the local repository, resolution will not be reattempted until
the update interval of spring-maven-external has elapsed or updates are forced
version of maven is Maven 3.0.3
How to solve this problem?
See http://bug.improve-community.com/view.php?id=160. It seems that this library is not deployed on any public maven repo. You'll have to download it and add it to your own private repository.