AnsweredAssumed Answered

Error in Custom Java Code Step in DevTest 9.5

Question asked by SARTH_GUPTA on Feb 1, 2017
Latest reply on Feb 13, 2017 by Mohankumar-5.R-5

Hi All,

 

I am using Custom Java Code Step for performing some actions (maximize browser window,scroll down in webpage) in my GUI Test Case .I am using Selenium Steps together Custom Java Code Steps.All these actions were working fine in DevTest 8.4 version (which I was using till now).But when I upgraded to Devtest 9.5.1 ,I am getting the below mentioned error.Please suggest further.

 

Code inside Custom Java Code Step (JSR 223):

1) Maximize window

import org.openqa.selenium.remote.RemoteWebDriver;
RemoteWebDriver driver = testExec.getStateObject("selenium.testrun").getDriver();
driver.manage().window().maximize();

 

2) Scroll Down in WebPage

import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.JavascriptExecutor;

 

RemoteWebDriver driver = testExec.getStateObject("selenium.testrun").getDriver();
JavascriptExecutor sc = (JavascriptExecutor)driver;
sc.executeScript("window.scrollBy(0,400)","");

 

Error Observed:

 

 

============================================================================
| Error in Script
============================================================================
| Step: ScrollDown
----------------------------------------------------------------------------
| Message: bsh.EvalError: Sourced file: inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' : Typed variable declaration : Error in method invocation: Method getDriver() not found in class'com.itko.lisa.glass.SeleniumTestNode$SeleniumState' : at Line: 6 : in file: inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' : .getDriver ( )
in inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' at line number 6
----------------------------------------------------------------------------
| Trapped Exception: bsh.EvalError: Sourced file: inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' : Typed variable declaration : Error in method invocation: Method getDriver() not found in class'com.itko.lisa.glass.SeleniumTestNode$SeleniumState' : at Line: 6 : in file: inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' : .getDriver ( )
in inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' at line number 6
| Trapped Message: javax.script.ScriptException: bsh.EvalError: Sourced file: inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' : Typed variable declaration : Error in method invocation: Method getDriver() not found in class'com.itko.lisa.glass.SeleniumTestNode$SeleniumState' : at Line: 6 : in file: inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' : .getDriver ( )
in inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' at line number 6
----------------------------------------------------------------------------
STACK TRACE
javax.script.ScriptException: bsh.EvalError: Sourced file: inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' : Typed variable declaration : Error in method invocation: Method getDriver() not found in class'com.itko.lisa.glass.SeleniumTestNode$SeleniumState' : at Line: 6 : in file: inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' : .getDriver ( )
in inline evaluation of: ``import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.J . . . '' at line number 6
at bsh.BshScriptEngine.evalSource(BshScriptEngine.java:102)
at bsh.BshScriptEngine.eval(BshScriptEngine.java:61)
at javax.script.AbstractScriptEngine.eval(Unknown Source)
at com.itko.lisa.test.ScriptExecHandler.executeScript(ScriptExecHandler.java:674)
at com.itko.lisa.test.ScriptExecHandler.executeScript(ScriptExecHandler.java:427)
at com.itko.lisa.test.UserScriptNode._execute(UserScriptNode.java:210)
at com.itko.lisa.test.UserScriptNode.execute(UserScriptNode.java:175)
at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
at com.itko.lisa.utils.ExecSubProcessNode.doFullExec(ExecSubProcessNode.java:354)
at com.itko.lisa.utils.ExecSubProcessNode.execute(ExecSubProcessNode.java:268)
at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
at com.itko.lisa.utils.ExecSubProcessNode.doFullExec(ExecSubProcessNode.java:354)
at com.itko.lisa.utils.ExecSubProcessNode.execute(ExecSubProcessNode.java:268)
at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
at com.itko.lisa.utils.ExecSubProcessNode.doFullExec(ExecSubProcessNode.java:354)
at com.itko.lisa.utils.ExecSubProcessNode.execute(ExecSubProcessNode.java:268)
at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
at com.itko.lisa.utils.ExecSubProcessNode.doFullExec(ExecSubProcessNode.java:354)
at com.itko.lisa.utils.ExecSubProcessNode.execute(ExecSubProcessNode.java:268)
at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
at com.itko.lisa.utils.ExecSubProcessNode.doFullExec(ExecSubProcessNode.java:354)
at com.itko.lisa.utils.ExecSubProcessNode.execute(ExecSubProcessNode.java:268)
at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1058)
at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:71)
at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:965)
at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
at java.lang.Thread.run(Unknown Source)
============================================================================

 

 

Thanks

Sarthak Gupta

Outcomes