PDA

View Full Version : [SOLVED] Selenium RC + ExtJS (Ext is not defined)



andvicente
12 Nov 2010, 3:52 AM
Im using Selenium RC to do functional testing in a aplication that uses ExtJS.
To execute my testing im also use JUnit 4 in Eclipse IDE.

Im trying to execute a java script in my JUnit Test:

selenium.getEval("Ext.getCmp('" + gridId + "').getView().getCel(0,0)")
But this statement throw a exception that "Ext is not defined".

In Firebug this function (Ext.getCmp('" + gridId + "').getView().getCel(0,0)) run and return the result.

I should add something in my Java Project or in Selenium Server?



com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: Ext is not defined
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
at com.thoughtworks.selenium.DefaultSelenium.getEval(DefaultSelenium.java:443)
at selenium.teste.CopyOfSeleniumTestCase.testeX(X.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

andvicente
17 Nov 2010, 5:38 AM
In valueOfGridScript I store the java script that will executed...
I execute the script with selenium.runScript that store the value of grid cell in the var cellValue.
To get a var of window I use this java script code: this.browserbot.getUserWindow().VARIABLE


String valueOfGridScript = "var cellValue= Ext.getCmp('grpPatrocinadores').getView().getCell(0,0).childNodes[0].firstChild.nodeValue";
selenium.runScript(valueOfGridScript);
String partner = selenium.getEval("this.browserbot.getUserWindow().cellValue");
System.out.println("Patrocinador: "+partner);