SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.71k stars 8.19k forks source link

Error: Could not find or load main class ..selenium-server-standalone-3.7.1.jar #5488

Closed flik closed 6 years ago

flik commented 6 years ago

Meta -

OS:
Ubuntu 14 Selenium Version:
selenium-server-standalone-3.7.1.jar Browser:
Firefox

Since Firefox version 48, Mozilla requires all add-ons to be signed. Until recently, Firefox support in Selenium was exclusively provided by an add-on. As this add-on is not currently signed, this solution does not work with the latest Firefox releases. As an alternative, Mozilla are working on a WebDriver specification compliant implementation named GeckoDriver. Please note that the specification is not complete, and that Selenium itself does not comply with the specification at this time. This means that features previously available through Selenium will not be available using GeckoDriver.

Any issue logged here for Firefox 48 or later will be closed as a duplicate of

2559. Our recommendation is to switch to GeckoDriver, or to continue testing

on Firefox 45 until GeckoDriver is a viable option for you. If you are interested in helping us to sign the add-on to restore support for later Firefox versions, please see the following comment for what's needed: https://github.com/SeleniumHQ/selenium/issues/2942#issuecomment-259717567

If the issue is with Google Chrome consider logging an issue with chromedriver instead: https://sites.google.com/a/chromium.org/chromedriver/help

If the issue is with Microsoft Edge consider logging an issue with Microsoft instead: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/

If the issue is with Firefox GeckoDriver (aka Marionette) consider logging an issue with Mozilla: https://bugzilla.mozilla.org/buglist.cgi?product=Testing&component=Marionette

If the issue is with Safari, only Safari 10+ is supported. Please log any Safari issue with Apple: https://bugreport.apple.com/

If the issue is with PhantomJS consider logging an issue with Ghostdriver: https://github.com/detro/ghostdriver

-->

Browser Version:

Expected Behavior - server should start

Actual Behavior - error is coming

Steps to reproduce -

sudo java ./selenium-server-standalone-3.7.1.jar 
[sudo] password for adminx: 
Error: Could not find or load main class ..selenium-server-standalone-3.7.1.jar

sudo java -jar selenium-server-standalone-3.7.1.jar 
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncherV3 : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
lmtierney commented 6 years ago

You need to launch it with -jar.

    java -jar ./selenium-server-standalone-3.7.1.jar
lmtierney commented 6 years ago

Whoops, didn't see you did the second time.

lmtierney commented 6 years ago

Java 8 is required, please see https://github.com/seleniumhq/selenium#requirements

flik commented 6 years ago

thanks. :)

AbhreshSugandhi commented 6 years ago

Hi, I have similar issue but in my case here is the response from the cmd: Error: Could not find or load main class .chrome.driver=

because of this I am unable to execute!

Commands used: java -Dwebdriver.chrome.driver= E:\Abhresh\Installation stuff\Exe Files\chromedriver.exe -jar grid.jar -role node -hub http://192.168.0.11:4444/grid/register

Unable to execute the script on the browser

package GridTest;

import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import java.net.MalformedURLException;
import java.net.URL;

import org.junit.Assert;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class TestGrid {
    static WebDriver driver;
    static String nodeUrl;

    @BeforeTest
    public void setup() throws MalformedURLException {
        System.setProperty("webdriver.chrome.driver", "E:\\Abhresh\\Installation stuff\\Exe Files\\chromedriver.exe");
        nodeUrl = "http://192.168.1.201:5555/wd/hub";
        DesiredCapabilities capabilities = DesiredCapabilities.chrome();
        capabilities.setBrowserName("chrome");
        capabilities.setPlatform(Platform.WINDOWS);
        driver = new RemoteWebDriver(new URL(nodeUrl), capabilities);
    }

    @Test
    public void simpleTest() {
        driver.get("https://www.edureka.co/");
        Assert.assertEquals("Instructor Led Online Courses with 24x7 On-Demand Support | Edureka", driver.getTitle());
    }

    @AfterTest
    public void afterTest() {
        driver.quit();
    }
}
mdzakirh commented 6 years ago

You have to use "" for the file path like "E:\Abhresh\Installation stuff\Exe Files\chromedriver.exe"

AbhreshSugandhi commented 5 years ago

thanks :-) will try

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.