when I'm trying to run test I have issue as on screenshot, where am I wrong?
thx
"C:\Program Files\Java\jdk1.8.0_11\bin\java" -ea -Didea.launcher.port=7537 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.0\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.0\plugins\testng\lib\testng-plugin.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\zipfs.jar;C:\Users\vol.7\Downloads\aaaaaa\src\main\resources\target\test-classes;C:\Users\vol.7\Downloads\aaaaaa\target\classes;C:\Users\vol.7\.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\2.44.0\selenium-chrome-driver-2.44.0.jar;C:\Users\vol.7\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\2.44.0\selenium-remote-driver-2.44.0.jar;C:\Users\vol.7\.m2\repository\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar;C:\Users\vol.7\.m2\repository\com\google\code\gson\gson\2.3\gson-2.3.jar;C:\Users\vol.7\.m2\repository\org\seleniumhq\selenium\selenium-api\2.44.0\selenium-api-2.44.0.jar;C:\Users\vol.7\.m2\repository\org\apache\httpcomponents\httpclient\4.3.4\httpclient-4.3.4.jar;C:\Users\vol.7\.m2\repository\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;C:\Users\vol.7\.m2\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\vol.7\.m2\repository\commons-codec\commons-codec\1.6\commons-codec-1.6.jar;C:\Users\vol.7\.m2\repository\com\google\guava\guava\18.0\guava-18.0.jar;C:\Users\vol.7\.m2\repository\net\java\dev\jna\jna\3.4.0\jna-3.4.0.jar;C:\Users\vol.7\.m2\repository\net\java\dev\jna\platform\3.4.0\platform-3.4.0.jar;C:\Users\vol.7\.m2\repository\org\testng\testng\6.9.9\testng-6.9.9.jar;C:\Users\vol.7\.m2\repository\junit\junit\4.10\junit-4.10.jar;C:\Users\vol.7\.m2\repository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar;C:\Users\vol.7\.m2\repository\com\beust\jcommander\1.48\jcommander-1.48.jar;C:\Users\vol.7\.m2\repository\org\apache\ant\ant\1.7.0\ant-1.7.0.jar;C:\Users\vol.7\.m2\repository\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar;C:\Users\vol.7\.m2\repository\org\yaml\snakeyaml\1.15\snakeyaml-1.15.jar;C:\Users\vol.7\.m2\repository\org\beanshell\bsh\2.0b4\bsh-2.0b4.jar;C:\Users\vol.7\.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\2.44.0\selenium-firefox-driver-2.44.0.jar;C:\Users\vol.7\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\vol.7\.m2\repository\org\apache\commons\commons-exec\1.1\commons-exec-1.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.0\plugins\testng\lib\testng.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.0\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.testng.RemoteTestNGStarter -port 54806 -usedefaultlisteners false -socket54807 -temp C:\Users\vol.7\AppData\Local\Temp\idea_testng36.tmp
org.testng.TestNGException: Cannot instantiate class Aaas at
org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:40)
at
org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:382)
at
org.testng.internal.ClassHelper.createInstance(ClassHelper.java:295)
at
org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:118)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:183) at
org.testng.internal.TestNGClassFinder.(TestNGClassFinder.java:128)
at org.testng.TestRunner.initMethods(TestRunner.java:416) at
org.testng.TestRunner.init(TestRunner.java:242) at
org.testng.TestRunner.init(TestRunner.java:212) at
org.testng.TestRunner.(TestRunner.java:166) at
org.testng.remote.RemoteTestNG$1.newTestRunner(RemoteTestNG.java:143)
at
org.testng.remote.RemoteTestNG$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG.java:272)
at
org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:587)
at org.testng.SuiteRunner.init(SuiteRunner.java:161) at
org.testng.SuiteRunner.(SuiteRunner.java:114) at
org.testng.TestNG.createSuiteRunner(TestNG.java:1290) at
org.testng.TestNG.createSuiteRunners(TestNG.java:1277) at
org.testng.TestNG.runSuitesLocally(TestNG.java:1131) at
org.testng.TestNG.run(TestNG.java:1048) at
org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:112) at
org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205) at
org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:176) at
org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:125) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483) at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.reflect.InvocationTargetException at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at
org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
... 27 more Caused by: java.lang.IllegalStateException: The path to
the driver executable must be set by the webdriver.chrome.driver
system property; for more information, at
com.google.common.base.Preconditions.checkState(Preconditions.java:197)
at
org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:105)
at
org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:89)
at
org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:117)
at Aaas.(Aaas.java:11) ... 32 more
Process finished with exit code 0
In your code it looks like you did 2 mistakes.
First thing...
Please remove the instantiation of "new ChromeDriver()" when a reference of type WebDriver created in class.
Instead create a referece:
public WebDriver driver;
Then instantiate the chrome driver inside the test case-->
#Test
public void testMethod(){
//Here, Before the instantiation just use setProperty method
System.setProperty("key","path to chrome driver.exe");
driver=new ChromeDriver();
}
and the Second thing is...
make sure the relative path is correct to chromedriver.exe file...
Use absolute path to the chrome driver.
You're creating the new ChromeDriver in your (implicit) constructor before you're calling: System.setProperty("webdriver.chrome.driver", ...)
You need to set the property before creating any Drivers (same applies to IE, Opera, etc.)
One approach is to create a static { ... } block and move your setting of System properties there. That'll get called before you create your Driver.
It looks like you are not given complete chromediver.exe path. More over over calling chrome driver before system.set property. please set system property first then call chrome driver..
System.setProperty("webdriver.chrome.driver", "E:\\selenium_setups\\chromedriver_win32\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
Thank You,
Murali
You haven't set a location for the chromedriver binary. Edit the configuration of your test by clicking on the drop down box in the top bar. Then add to your VM options a path for the chromedriver binary:
-Dwebdriver.chrome.driver=<ABSOLUTE_PATH_TO>/chromedriver
Since you are using a maven project you may find this maven plugin useful:
https://github.com/Ardesco/selenium-standalone-server-plugin
It will download the driver binaries for you and set up the correct system properties when running your tests through maven. There is a template that uses it here that you can use as an example of how to get it configured:
https://github.com/Ardesco/Selenium-Maven-Template
*Note* Running the test through intelliJ is not the same as running it through maven. System properties that are only set through maven will not have been set in IntelliJ when you run a test through the IDE. This is why you need to edit your test configuration if you have already set the correct System Properties through maven.
Related
When connecting to MySQL, I get an error (see below).
Click here for code
I get this output:
run:
Now connecting to databse...
java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.java:1062)
at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3556)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2513)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2283)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:822)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:404)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:317)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at dbms_basic.Dbms_Basic.main(Dbms_Basic.java:28)
Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.java:1007)
... 15 more
BUILD SUCCESSFUL (total time: 0 seconds)
How can I solve this?
Your error clearly says casting is not possible, because a java.math.BigInteger class instance is not an instance of java.lang.Long class.
Now the question arises who is doing casting at what level, when we ask the JDBC driver to make a connection, it is doing lot of work behind the scene before it actually give us back the proper working object of connection.
The problem seems with your version of MySQL in combination with your version of mysql-connector.jar. Try a newer version of MySQL Connector/J (see https://dev.mysql.com/downloads/connector/j/ for the latest version), for example upgrade to 5.1.47 or 8.0.12 if you are using an older version.
This issue is not there with 5.1.45 as mentioned in the above comments. Available to download at,
https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.45/
Another way, because changing the version from mysql does not worked for me, for help another people:
Long.parseLong(String.valueOf(item[0]);
There is a miss-match between your MySQL version, which might be the latest 8.0.19, but the MySQL driver file is older version may be 5.1.23, which is generally available with the NetBeans IDE. To overcome this, download the mysql-connector-java-5.1.48.jar from this link in your PC download connector/j 5.1.48 zip file
(4.6MB)
Now right-click on project name in the netbeans IDE, go to services, in that choose 'Libraries', in it choose 'Add library', then don't opt for available libraries( the drop-down menu will list a JDBCDriver file which has 'mysql-connector-java-5.1.23.jar' file inside it, which is an older version, this is causing the miss-match). Therefore, instead click on 'Create Library', now give it any name of your choice, then click the create button, a browse window will pop-up, go to the directory where you have downloaded the 'mysql-connector-java-5.1.48.zip' folder, open it and select the java jar file 'mysql-connector-java-5.1.48.jar' and click 'ok'. The library folder of your project tree will now show 'JDBCDriver-mysql-connector-java-5.1.48.jar' added in the list of libraries(JDK and Tomcat) . Now try connecting to your database again by clicking on the 'run' button, go to the JSP link, and you see that this time you are connected.
For me updating the connector wasn't enough, I also had to complete my DriverManager.getConnection() url parameter with all the arguments, even if the error message was not mentionning this issue.
In my case this parameters were needed :
"jdbc:mysql://127.0.0.1:3306/database?zeroDateTimeBehavior=convertToNull&serverTimezone=UTC"
Connector : mysql-connector-java-8.0.17.jar
mysql version : 8.0.17
Using java on netbeans.
This is a common issue when you use outdated/unsupported mysql connector driver. If youre using x86 version of Netbeans, your driver will usually be found in the Program(x86) folder an not the Program folder. something like this "C:\Program Files (x86)\MySQL\Connector J 8.0\mysql-connector-java-8.0.23.jar"
I'm trying to launch the selenium scripts from SoapUI 5.2.1 tool with the following launching script:
System.setProperty("webdriver.chrome.driver","D:\\SoapUI-5.2.1\\bin\\ext\\chromedriver.exe")
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.MyUrl.com")
driver.manage().timeouts().implicitlyWait(120,TimeUnit.SECONDS);
I have kept the following selenium dependency file in SoapUI/bin/ext folder
- chromedriver 2.36
- selenium-server-standalone-3.4.0.jar
- selenium-chrome-driver-2.3.1.jar
But I'm getting the following error message while running the script.
Tue May 22 15:51:47 IST 2018:ERROR:java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:84)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
at Script1.launchURL(Script1.groovy:49)
at Script1.run(Script1.groovy:20)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:141)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Anyone help me to solve this issue as I'm not able to find correct solution in Google.
Thanks
Karunagara Pandi
This error message...
java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
...implies that a NoSuchMethodError was raised when the os command findExecutable() tried to locate the executable as per your System.setProperty() line.
Class NoSuchMethodError
NoSuchMethodError extends IncompatibleClassChangeError and as per the Java Docs it is thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method. Normally, this error is caught by the compiler and this error can only occur at run time if the definition of a class has incompatibly changed. Incompatible class change occurs due to change in definition of some class, on which the currently executing method depends.
What went wrong?
You have created the WebDriver instance i.e. driver and casted it through ChromeDriver(). But the SoapUI/bin/ext sub-directory contains multiple defination from selenium-server-standalone-3.4.0.jar and selenium-chrome-driver-2.3.1.jar.
Solution
Perform the following steps :
Remove selenium-chrome-driver-2.3.1.jar from SoapUI/bin/ext sub-directory.
Upgrade JDK to recent levels JDK 8u171.
Upgrade Selenium to current levels Version 3.11.0.
Upgrade ChromeDriver to current ChromeDriver v2.38 level.
Keep Chrome version at Chrome v66.x levels. (as per ChromeDriver v2.38 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.
Code to initialize the chromedriver is like the below code mentioned
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver_win32\\chromedriver.exe");
Webdriver driver = new ChromeDriver();
You need to set the correct dependency artifact id of selenium like
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
</dependency>
if you are using jar file then download the selenium jar file from here Authentic link
Please see my grid batch file. (I added both chrome binary and chrome driver location in my path)
My code works perfectly if I use firefox but for chrome and IE it throws an Exception given below. I am sure I am missing a very trivial thing but I am not able to figure it out.
Batch file
set HERE=C:\Users\Administrator\Downloads
set JAVA_HOME=%HERE%\jdk-7u13-windows-x64
set PATH=%JAVA_HOME%\jre\bin;%JAVA_HOME%\bin;%CHROME_DRIVER_LOC%;%IE_DRIVER_LOC%;%CHROME_BINARY_LOC%;%PATH%;
set SELENIUM_VERSION=2.29.0
set CHROME_VERSION=chromedriver_win_26.0.1383.0
set HUB_URL=http://localhost:4444/grid/register
set CHROME_DRIVER_LOC=C:\Users\Administrator\Downloads\chromedriver_win_26.0.1383.0\chromedriver.exe
set IE_DRIVER_LOC=C:\Users\Adminstrator\Downloads\IEDriverServer_x64_2.31.0\IEDriverServer.exe
set CHROME_BINARY_LOC=C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe
start java -jar selenium-server-standalone-2.29.0.jar -role hub
start java -jar selenium-server-standalone-2.29.0.jar -role node
-Dwebdriver.chrome.driver=%CHROME_DRIVER_LOC% -hub %HUB_URL% -port 5556
My sample code:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());
URL url = new URL(“<http://localhost:4444/wd/hub>”);
WebDriver driver = new RemoteWebDriver(url, capabilities);
// And now use this to visit Google
driver.get(“web page”);
Exception I am getting :
Exception in thread “main” org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://code.google.com/p/chromedriver/downloads/list
Command duration or timeout: 608 milliseconds
Build info: version: ’2.29.0′, revision: ’58258c3′, time: ’2013-01-17 22:47:00′
System info: os.name: ‘Windows Server 2008 R2′, os.arch: ‘amd64′, os.version: ’6.1′, java.version: ’1.7.0_13′
Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:533)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129)
at test.Test.main(Test.java:32)
Caused by: java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see ….
Please help! I couldn’t understand what I am doing wrong. I have been struggling with this from quite some time now. Any help will be very much appreciated.
Thanks
Sushmita
I think, the below line is the culprit
start java -jar selenium-server-standalone-2.29.0.jar -role node
-Dwebdriver.chrome.driver=%CHROME_DRIVER_LOC% -hub %HUB_URL% -port 5556
Use below line and check if it is working.
start java -Dwebdriver.chrome.driver=%CHROME_DRIVER_LOC% -jar selenium-server-standalone-2.29.0.jar -role webdriver -hub %HUB_URL% -port 5556
With Chrome and IE, you will need to define a driver executable path, you can fine the files here:
http://code.google.com/p/chromedriver/downloads/list
and http://code.google.com/p/selenium/downloads/list
Then you will need something like this before you create a new ChromeDriver:
String chromeDriverPath = "C:\ChromeDriver.exe";
System.setProperty("webdriver.chrome.driver", chromeDriverPath);
A very simple workaround is to place the IEDriverServer and the chromedriver executables in the same folder as your selenium jar file
when I run ant for a Testng application, I am unable to load com.mysql.jdbc.Driver.
Below is the exception thrown.
[testng] java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
[testng] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[testng] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[testng] at java.security.AccessController.doPrivileged(Native Method)
Thanks and regards,
Sreekanth
The CLASSPATH environment variable is only used by the java.exe command and even then only when used without any of the -cp, -classpath, -jar arguments. It is ignored by IDE's.
That environment variable is in real world also considered a poor practice since it breaks portability. It's only "useful" for Sun to prevent that starters get tired of typing the same classpath again and again in the -cp or -classpath arguments. In real world, batch/shell files are preferred.
If you're using an IDE, The classpath is called the "build path" (it represents both compiletime and runtime classpath). You can configure it in the project's properties. You can add a complete folder, you can add individual/external JAR files, you can link projects, etcetera. Make use of it. Forget the whole CLASSPATH environment variable.
For command prompt,
You have to put the full path to the jarfile in the classpath (including the filename):
.;C:\j2sdk1.4.2_16\jre\lib;
C:\Program Files\mysql-connector-java-3.1.144\mysql-connector-java-3.1.14-bin.jar
As Hippo said, you have to restart cmd after changing that. If it doesn't work, launch your program like this:
java -cp ".;C:\j2sdk1.4.2_16\jre\lib;
C:\Program Files\mysql-connector-java-3.1.144\mysql-connector-java-3.1.14-bin.jar"
my.class.Name
I have a small Swing monitoring app that I want to run in the Tomcat 6 JVM. The app is started by dynamically loading the monitoring class from a webservice running under Tomcat. This works in Windows but on Linux (Ubuntu 10.4) I'm getting some errors.
My first error was that I was getting a HeadlessException. I'm not explicitly using headless mode and after searching around I changed Tomcat's library path (via -Djava.library.path in catalina.sh) to point to the client lib (ie. .../java-6-sun-1.6.0.26/jre/lib/i386/client) instead of the server lib. I also set DISPLAY=:0:0 in catalina.sh. This got rid of the headless exception but now I get:
java.lang.InternalError: Can't connect to X11 window server using ':0:0' as the value of the DISPLAY variable.
sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:52)
sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:155)
java.security.AccessController.doPrivileged(Native Method)
sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:131)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
java.awt.Window.init(Window.java:380)
java.awt.Window.<init>(Window.java:433)
java.awt.Frame.<init>(Frame.java:403)
java.awt.Frame.<init>(Frame.java:368)
javax.swing.JFrame.<init>(JFrame.java:158)
com.quinsoft.zeidon.objectbrowser.ObjectBrowser.startup(ObjectBrowser.java:60)
At this point I'm stuck. I've tried a bunch of different things (like explicitly setting "headless=false" and using different values for DISPLAY) and nothing changes. Does anybody have any ideas?
Version info:
Tomcat 6.0.28
Java 1.6
Ubuntu 10.4
Try setting '-Djava.awt.headless=true' if you have not already tried it.