Hi All,
To reduce the redesign of Selenium test cases (we know, we can redesign by Selenium Integration Step using JSON Script), we tried an alternative way of having all our Selenium test cases to a Jar file. We thought of accessing methods which are present in JAR in our Execute Script Step by creating an object for the main class in Selenium Code like this.
public void initiateSeleniumCode()
{
// some code here
}
we placed all the support jar files for Selenium in hotdeploy folder. But we are facing below error.
Target exception: java.lang.SecurityException: Scripts cannot call Runtime.exec()
Can someone help in this regard please why we are getting this error.
Any approach to resolve this issue.
************************************************************************************************************************************
============================================================================
| Error in Script
============================================================================
| Step: Execute script (JSR-223)
----------------------------------------------------------------------------
| Message: bsh.TargetError: Sourced file: inline evaluation of: ``import com.sankar.test.test; test t=new test();
t.initiateSeleniumCode(); return . . . '' : Method Invocation t.initiateSeleniumCode:
at Line: 4 : in file: inline evaluation of: ``import com.sankar.test.test; test t=new test(); t.initiateSeleniumCode();
return . . . '' : t .initiateSeleniumCode( )
Target exception: java.lang.SecurityException: Scripts cannot call Runtime.exec()
in inline evaluation of: ``import com.sankar.test.test; test t=new test(); t.initiateSeleniumCode(); return . . . '' at line number 4
----------------------------------------------------------------------------
| Trapped Exception: bsh.TargetError: Sourced file: inline evaluation of: ``import com.sankar.test.test; test t=new test(); t.initiateSeleniumCode(); return . . . '' : Method Invocation t.initiateSeleniumCode: at Line: 4 : in file: inline evaluation of: ``import com.sankar.test.test; test t=new test(); t.initiateSeleniumCode(); return . . . '' : t .initiateSeleniumCode( )
Target exception: java.lang.SecurityException: Scripts cannot call Runtime.exec()
in inline evaluation of: ``import com.sankar.test.test; test t=new test(); t.initiateSeleniumCode(); return . . . '' at line number 4
| Trapped Message: javax.script.ScriptException: bsh.TargetError: Sourced file: inline evaluation of: ``import com.sankar.test.test; test t=new test(); t.initiateSeleniumCode(); return . . . '' : Method Invocation t.initiateSeleniumCode: at Line: 4 : in file: inline evaluation of: ``import com.sankar.test.test; test t=new test(); t.initiateSeleniumCode(); return . . . '' : t .initiateSeleniumCode( )
Target exception: java.lang.SecurityException: Scripts cannot call Runtime.exec()
in inline evaluation of: ``import com.sankar.test.test; test t=new test(); t.initiateSeleniumCode(); return . . . '' at line number 4
----------------------------------------------------------------------------
************************************************************************************************************************************
Here is the code written,