5

I am running a selenium script using the groovy script test step in SOAPUI but I am getting the following error? How to fix this?

java.lang.UnsupportedClassVersionError: org/openqa/selenium/support/ui/ExpectedCondition : Unsupported major.minor version 52.0

Here is the script I am running:

import org.openqa.selenium.WebElement
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.support.ui.ExpectedCondition
import org.openqa.selenium.support.ui.WebDriverWait

// Create a new instance of the Firefox driver
// Notice that the remainder of the code relies on the interface, 
// not the implementation.
WebDriver driver = new FirefoxDriver()

// And now use this to visit Google
driver.get("http://www.google.com")

// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"))

// Enter something to search for
element.sendKeys("Cheese!")

// Now submit the form. WebDriver will find the form for us from the element
element.submit()

// Check the title of the page
log.info("Page title is: " + driver.getTitle())

// Google's search is rendered dynamically with JavaScript.
// Wait for the page to load, timeout after 10 seconds
(new WebDriverWait(driver, 10)).until(new ExpectedCondition() {
    public Boolean apply(WebDriver d) {
        return d.getTitle().toLowerCase().startsWith("cheese!")
    }
});

// Should see: "cheese! - Google Search"
log.info("Page title is: " + driver.getTitle())

//Close the browser
driver.quit()

Where I can make the change in the following soapui bat file?

@echo off

set SOAPUI_HOME=%~dp0
if exist "%SOAPUI_HOME%..\jre\bin" goto SET_BUNDLED_JAVA

if exist "%JAVA_HOME%" goto SET_SYSTEM_JAVA

echo JAVA_HOME is not set, unexpected results may occur.
echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
goto SET_SYSTEM_JAVA

:SET_BUNDLED_JAVA
set JAVA=%SOAPUI_HOME%..\jre\bin\java
goto END_SETTING_JAVA

:SET_SYSTEM_JAVA
set JAVA=java

:END_SETTING_JAVA

rem init classpath
set OLDDIR=%CD%
cd /d %SOAPUI_HOME%

set CLASSPATH=%SOAPUI_HOME%soapui-5.2.1.jar;%SOAPUI_HOME%..\lib\*
"%JAVA%" -cp "%CLASSPATH%" com.eviware.soapui.tools.JfxrtLocator > %TEMP%\jfxrtpath
set /P JFXRTPATH= < %TEMP%\jfxrtpath
del %TEMP%\jfxrtpath
set CLASSPATH=%CLASSPATH%;%JFXRTPATH%

rem JVM parameters, modify as appropriate
set JAVA_OPTS=-Xms128m -Xmx1024m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -Dsoapui.properties=soapui.properties "-Dsoapui.home=%SOAPUI_HOME%\" -splash:SoapUI-Spashscreen.png

set JAVA_OPTS=%JAVA_OPTS% "-Dsoapui.https.protocols=SSLv3,TLSv1.2"

if "%SOAPUI_HOME%" == "" goto START
    set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.libraries="%SOAPUI_HOME%ext"
    set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.listeners="%SOAPUI_HOME%listeners"
    set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.actions="%SOAPUI_HOME%actions"
    set JAVA_OPTS=%JAVA_OPTS% -Djava.library.path="%SOAPUI_HOME%\"
    set JAVA_OPTS=%JAVA_OPTS% -Dwsi.dir="%SOAPUI_HOME%..\wsi-test-tools"
rem uncomment to disable browser component
rem    set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.browser.disabled="true"

:START

rem ********* run soapui ***********

"%JAVA%" %JAVA_OPTS% com.eviware.soapui.SoapUI %*
cd /d %OLDDIR%
user5653362
  • 161
  • 2
  • 15
  • Use Java 8 to run your application. – dunni Nov 02 '16 at 17:16
  • my java_home is set to jre 8 – user5653362 Nov 02 '16 at 17:16
  • I am new to this, can you please provide with the steps? – user5653362 Nov 02 '16 at 17:17
  • What does it show when you click menu `Help -> System Properties`? Look for java path. Is it the same as echo $JAVA_HOME on command line? – Rao Nov 02 '16 at 17:37
  • It is not the same soap uses 7.0 and the command line shows 1.8. Do i need to change the soap to use 8.0? Should i put jre or jdk on the path? – user5653362 Nov 02 '16 at 17:44
  • Yes, of course, change both to use same. You may need to check SOAPUI_HOME/bin/soapui.bat or .sh to change java version. have backup before. – Rao Nov 02 '16 at 18:06
  • this is my soap ui bat file looks like where should i make the change? I have edited in my question – user5653362 Nov 02 '16 at 18:07
  • What is the output of commands (from command line): `echo %JAVA_HOME%` and `echo %PATH%`. Also check if `jar ` command works. – Rao Nov 02 '16 at 18:51
  • C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32\WindowsPowerShell\v1.0\;C:\Python27;C:\Program Files\Java\jre7\bin;C:\Program Files\apache-maven-3.3.9\/bin returned when I ran echo %Path% and C:\Program Files\Java\jre1.8.0_91 returned when I ran echo%JAVA_HOME% – user5653362 Nov 02 '16 at 18:55
  • and unable to recognize the jar command – user5653362 Nov 02 '16 at 18:59

1 Answers1

5

Please follow the instructions, before proceeding close SoapUI tool.

  • Open a command prompt, go to SOAPUI_HOME/bin directory.
  • Run below commands(change java home as per your environment)

    set JAVA_HOME=c:\Java\jdk1.8.0
    set PATH=%JAVA_HOME%\bin;%PATH%

  • Run soapui.bat which will open SoapUI tool

  • Now again check the java version from Help -> System Properties. Should match this time.

  • If matches, try to run your script.

Rao
  • 20,781
  • 11
  • 57
  • 77
  • 1
    No luck still the same – user5653362 Nov 02 '16 at 19:20
  • my jdk is located in the different folder. Here is the echo %PATH% C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32\Wind‌​owsPowerShell\v1.0\;‌​C:\Python27;C:\Progr‌​am Files\Java\jre7\bin;C:\Program Files\apache-maven-3.3.9\/bin and here is the echo%JAVA_HOME% - C:\Program Files\Java\jre1.8.0_91 – user5653362 Nov 02 '16 at 19:22
  • 1
    Please join @ http://chat.stackoverflow.com/rooms/127213/discussion-between-user5653362-and-rao – Rao Nov 02 '16 at 19:23
  • Here is what My path looks like - C:\Program Files (x86)\Java\jdk1.8.0_101\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Java\jdk1.8.0_101;C:\Python27;C:\Program Files\apache-maven-3.3.9\/bin but still no luck – user5653362 Nov 02 '16 at 20:40
  • 1
    @user5653362, were you able to set the environment variables correctly in your system and retry it? – Rao Nov 03 '16 at 11:11
  • yes, it is setup correctly now. JAVA_HOME = C:\Program Files (x86)\Java\jdk1.8.0_101 AND PATH = C:\Program Files (x86)\Java\jdk1.8.0_101\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Java\jdk1.8.0_101;C:\Python27;C:\Program Files\apache-maven-3.3.9\/bin – user5653362 Nov 03 '16 at 13:29
  • no but it is still using java 7. why soap ui cannot run selenium at java 7? – user5653362 Nov 03 '16 at 13:35
  • 1
    Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/127289/discussion-between-rao-and-user5653362). – Rao Nov 03 '16 at 13:52