Testing Ext JS & Ext GWT Applications With Selenium
Overview
As developers we can create great software. Unfortunately, we usually introduce a few bugs along the way. Using a testing tool can ensure we catch the bugs and resolve them quickly.
There are many different approaches to testing. Some advocate writing the tests within the application, others suggest a separate testing environment entirely. There are merits to both these approaches. For this blog post, I've focused our attention on Selenium as both Ext JS and Ext GWT and benifit from this "black box" testing methodology.
Selenium provides a powerful mechanism to test your Ext applications. Selenium works by executing tests against your running application within the browser of your choice. Selenium tests emulate the way a user would interact with your application by executing JavaScript to simulate user actions. Selenium tests run as a form of "integration" tests as they execute against your running application.
Both Ext JS and Ext GWT applications can benefit from Selenium tests. In fact, with few exceptions, the tests created for one product should be interchangeable as both products produce the same DOM structure.
With GXT applications, GWT provides built in JUnit support. This provides a great way to test your application. However, these tests run only in host mode. Being able to test your compiled application in multiple browsers is important as some issues only appear within your compiled application.
In general, you create Selenium tests and then execute them in a variety of ways. This tutorial will demonstrate creating tests with Selenium IDE, a Firefox plugin, and creating tests within Java. Tests will be loaded and executed within the Selenium IDE, and Java JUnit tests will be executed using Selenium Remote Control.
Selenium IDE
Selenium IDE is a Firefox extension that allows you to create, edit, and execute your tests. Tests can either be created manually, or by "recording" your actions. Recording can help you get a feel on how the Selenium commands are generated, but in most cases you will want to tweak the generated commands.
A Selenium test is a list of commands. Commands can be seen as actions, such as "click this element", "type into this field", and "assert an element exists".
Install Selenium IDE
First, you will need to install the plugin which can be found here. Once installed you can choose or from the Firefox application menu.
Spend some time playing around with Selenium IDE. You can use the record button (red circle) to have the tool record your actions or you can enter commands manually. Most commands require a locator string. The locater string is repsonsible for identifying elements. There are various "types" of locator strings which are covered later.
Using Selenium IDE you can save and load tests. Also, notice the source tab. This tab allows you to view the test source. Selenium tests are saved as HTML files and can be exported to multiple server-side languages PHP, Ruby, Java, C#, Perl, and Python.
Creating a new Selenium Test
In this example, we will be testing both an Ext JS and Ext GWT form and it's fields. First, let us take a look at the example code we will be testing. You can find the source code here:
Rather than creating a test from scratch, we will load an existing test file (listed above). Download this either the Ext JS or Ext GWT file to your file system. Then open the test in the Selenium IDE by selecting . Once loaded, Selenium IDE should look this this:
Notice the list of commands. Take a look at each command to get a feel of what the test is doing. If you opened Selenium IDE as seperate window, close it. Then open Selenium IDE using . This will place selenium in the sidebar making it easier to run and monitor tests.
You can execute the test by clicking the first icon with the green arrow in the tool bar. Notice that you can control execution speed, use break points, execute individual commands, etc. After running your test, you screen should look like this:
Notice the form fields have been filled out. Examine the commands closely to see what actions were taken and what assertions where made. This test only touches the surface of things you can accomplish with commands. Note: When running the Ext JS test file, the radios and check boxes will not show the checked state, however, the true state will be correct, and the tests will run successfully.
Selenium Locators
Many Selenium commands require a locator to be specified. A locator is a way to identify an element in the page (the DOM to be specific). There are various types of locators including id, name, dom, xpath, link, and css. For this tutorial, XPath expressions where used. XPath expressions provide a powerful mechanism to identify elements. Example expressions look like this:
//input[@name='name'] |
//input[@name='name' and contains(@class, 'x-form-invalid')] |
//input[@name='company']/following-sibling::img |
//div[@id='Apple'] |
//div[@class='x-combo-list-item'][3] |
Here are a few examples using CSS selectors:
css=html:root |
css=div#structuralPseudo :nth-last-child(2) |
css=a[class~="class2"] |
Executing Tests with Selenium Remote Control (RC)
Selenium IDE provides a great way to create your tests and execute them in Firefox. Tests can only be run by manually opening Firefox and executing tests. What if you want to run you want to automate your tests and run them in other browsers? This is where Selenium Remote Control comes into play.
From the Selenium website: "Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. Selenium RC comes in two parts. 1. A server which automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them. 2. Client libraries for your favorite computer language."
Download Selenium RC
In addition to Selenium IDE, Selenium RC must be downloaded and can be found here. After downloading, unzip the file to your file system.
Starting the Server
The first step in using Selenium is to start the server. The server is responsible for executing your tests. The server will open browser instances, run tests, and close browsers. The server is written in Java and can be started by executing this command:
java -jar selenium-server.jar
The command should be executed from the folder where the selenium-server.jar is located.
To run your tests in Java, you must reference the Java client library. See selenium-java-client-driver.jar in the Selenium RC download.>
Creating a test in Java
Selenium RC supports various languages, we will focus on Java. Rather than creating the Java test from scratch, Selenium IDE can be used to create the base Java code needed to create the test. From Selenium IDE, select the source tab, then choose Options / Format / Java. You will see the test is converted form HTML to Java. You can then copy and past the Java code to be used in your Java test. You can use the same steps to create code in other languages such as PHP and Ruby.Here is the Java code that was created using the template code from Selenium IDE:
Notice the use of "pause" after opening the application. This is needed to allow the GWT application to load. Other than that, the test code is a direct paste from the code generated in Selenium IDE. Notice that the test is using "*explorer" to execute the test. Firefox, Opera, Safari, Chrome are also supported. Keep in mind that the browser must be installed on the same maching where the Selnium server is running.
The new JUnit test can be executed just like any other JUnit test. The test can be executed with Eclipse.
Selenium Grid
Although it is not used in the tutorial, Selenium Grid is worth mentioning. From the website: "Based on the excellent Selenium web testing tool, Selenium Grid allows you to run multiple instances of Selenium Remote Control in parallel. Even better, it makes all these Selenium Remote Controls appear as a single one, so your tests do not have to worry about the actual infrastructure. Selenium Grid cuts down on the time required to run a Selenium test suite to a fraction of the time that a single instance of Selenium instance would take to run."Summary
The tutorial demonstrated how load and run tests within Selenium IDE. The test code was ported to Java where it was run using Selenium Remote Control in a JUnit. This tutorial demonstrated the major moving parts involved in Selenium tests. It is recommended to take a look at the Selenium documentation and tutorials for more information.
Many thanks go out to the Selenium Team. There is a slight learning curve getting familiar with the product but I found it straightforward. The time was well spent as it opens up a new approach to testing web applications.

There are 86 responses. Add yours.
Cornelius Weiss
4 years agoGreat Post,
you saved my x-mas time!
cu
Cornelius
Americo Savinon
4 years agoGood post. You are right.. there is a slight learning curve, but this is a really good start for automated UI testing using Ext Js + Selenium IDE.
MT22???? » Ext JS - Blog ? Selenium ?????????
4 years ago[...] Testing Ext JS & Ext GWT Applications With Selenium [...]
Chris Khoo
4 years agoI’m sorry, but whatever happened to using good ol’ Javascript, especially if the webapp is primarily driven by one or a few HTML/JS pages - which ExtJS is very much designed for?
It’s not exactly the same in terms of interacting directly with the UI, but running the events themselves (click, change, etc.) in code and disabling modal dialog boxes (alert, confirm, etc.) for tests should be sufficient.
Then you eliminate a learning curve, don’t have to write your tests in another language, plus you can test on more browsers.
Ajaxian » Testing Ext Applications With Sele
4 years ago[...] Meyer has written a detail article on testing Ext applications, both Ext JS and GXT versions: Both Ext JS and Ext GWT applications can benefit from Selenium [...]
Testing ExtJS Applications With Selenium | Neuroso
4 years ago[...] Testing Ext JS & Ext GWT Applications With Selenium [...]
Ajax Girl » Blog Archive » Testing Ext
4 years ago[...] Meyer has written a detail article on testing Ext applications, both Ext JS and GXT versions: Both Ext JS and Ext GWT applications can benefit from Selenium [...]
matthew
4 years agothank u r information
it very useful
u r blog Is very nice
Thomas Broyer
4 years agoYou’re wrong about JUnit and GWT: you can actually run JUnit tests in “web mode” (that’s what the GWT team is using BTW, have a look at the Ant build files from GWT), either using RMI to a set of BrowserManagerServers (what’s called remote-web tests), “hybrid” mode (compiled app within the GWTShell/JUnitShell; what they call “local web” mode) or… Selenium RC !
There’s also a “manual” mode where you launch the browser(s) yourself and give it/them the JUnitShell URL, and an experimental “external browser” mode (you give the JUnitShell a list of executables that’ll be launched, passed the JUnitShell URL as a command-line argument).
This however doesn’t execise your *application*, as the compiled code is a set of GWTTestCases, not your real, production-ready application.
Well, GWT/JUnit integration is for unit-testing, while you’re proposing doing UI testing or integration testing, which is not the same thing.
Darrell Meyer
4 years agoThomas, thanks for information and correction about GWT and JUnit (web mode). It makes sense that the tests run compiled test code. I am not suggesting that Selenium tests should replace any JUnit unit tests, rather to use both as they complement each other (unit test vs. integration).
Chinmay
4 years agoThanks for this blog post. This does cover the simplest of applications, but does not appear to cover the issue of locator stability when using Ext-JS in non-trivial applications. We’ve explored using IDs and CSS selectors when constructing our locators. Unfortunately, in Ext-JS it is not possible to uniquely identify UI objects using ID. Even minor changes in the UI will change the ID of the previous UI widgets. The order in which UI widgets get rendered also affects IDs and breaks the selenium tests.
There are similar issues when using CSS selectors to uniquely identify UI components, but this appears to be a promising approach. Does the Ext-JS team have any recommendations on how to address this issue?
Thanks in advance for your reply.
smarek
4 years agoWe started to use Selenium couple of months ago. Now I’m co-developing simple framework for testing web application. Especially for testing ExtJS application but not only.
Our testing framework uses Selenium and TestNG. 4 days ago the project was published on Google Code
KDEV-WTF
http://code.google.com/p/kdev-wtf/
To make manipulation easier the concept of adapters were used. So far the frame work is used for 3 projects and it seems to work fine (for our purposes)
If someone is interested please take a look at project page. The more information will be addad asap.
Javascript News » Blog Archive » Testi
4 years ago[...] Meyer has written a detail article on testing Ext applications, both Ext JS and GXT versions: Both Ext JS and Ext GWT applications can benefit from Selenium [...]
Matthew
4 years agoHow do you set the name field of an ext component?
Testing Javascript User Interfaces with Selenium |
4 years ago[...] Meyer wrote an interesting Article on ExtJS Blog how to test JavaScript generated User Interfaces with Selenium. Selenium is tool to [...]
Alexander
4 years agoRefactoring is the key. If you wire all your tests with capture and play you will end up with an ugly and unwieldy suit of trash.
Starting selenium and stopping it at each test case is also lame.
You should separate your test cases from your test harness. Thus if your change from GWT to Yahoo tool kit or Dojo you do the change in only one place.
Not to mention that capture and play approach will not handle an asynchronous web application because the UI will change underneath your tests without your interaction. Consider a web application that display a grid that is updated by the server in real time with the new bids posted by other users on the system.
If you capture and play you will never be sure what row in the grid your data supposed to be in. So you have to write some code to do that for you.
With that in mind the approach for testing any Ajax app with selenium requires development of Test Harness, Declaring your locators in a class of its own, and writing some parsers that can grab the HTML from selenium and interrogate it OUTSIDE if the browser session because in the browser the DOM could be changed by the asynchronous process.
This sounds like extra work. But in the end you end up with a flexible and stable suite that is easy to maintain and write test cases against. As a bonus you can use it for load and stress test as well (See Selenium Grid)
All in all, good. But do not use capture and play. It generates UGLY and UNWIELDY code.
Mechanism of testing Ext JS Applications with Sele
4 years ago[...] Ext JS has written a detailed brief description about the tool in the respective blog titled “Testing Ext JS & Ext GWT Applications With Selenium“. He explained about how we can create Selenium tests and execute them in a variety of ways. [...]
Vivekanand
4 years agoThis is awesome, and I would like to thank “Darrell Meyer” on briefing about the tool… really I will have a look at it
Thanks,
Vivek
[http://www.developersnippets.com]
David
4 years agoAnybody got the dragAndDrop command working for extjs? It looks like the ‘drop’ is ignored, possibly due to a missing mouse over on the target zone.
Tony OHagan
4 years agoCurrently ExtJS generates unique but meaningless id’s on DOM elements. By default, Selenium IDE uses these id’s when auto recording events on HTML control elements (buttons, fields etc). Add a new widget on the page and the test script recordings all break.
Some time ago I proposed that ExtJS support an additional config property on all widgets so that a meaningful prefix can be applied to all HTML control DOM elements that are generated by the widget. Generated ids would then be stable and meaningful so that recorded tested are readable and maintainable. Yes, you can painfully rewrite each recorded rule to use an xpath or CSS selector but this costs valuable time. It would be so much simpler and quicker to use Selenium if it’s recorded coded that uses ids *just worked*.
?????? PHP-???????? - PHPanywhere.com | ??? 2.0 ??
4 years ago[...] ??????, ??? ?????? PHP-???????? - PHPanywhere.com. ???????? ?? Ext JS. ?????????? ??? ?????? ?????? ???????????? - [...]
??
4 years ago???????
chandan
4 years agoHello,
Please help me to automate selenium testcases.I have to change Javascript file prsent in selenimu.How to do that?If anuone has any idea please inform me.
Nitin Gautam
4 years agoReally a helpful article. Thanks!!
Condor
4 years agoI would strongly recommend using ‘waitForCondition’ instead of ‘pause’!
Gopalan
3 years agoHi,
I am using firefox version 3 and started trying this exercise. But selenium IDE is recording the scripts differently than what is get posted.
The following are the recorded scripts
package com.example.tests;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
public class NewTest extends SeleneseTestCase {
public void setUp() throws Exception {
setUp(“http://change-this-to-the-site-you-are-testing/”, “*chrome”);
}
public void testNew() throws Exception {
selenium.open(”/playpen/gxt/selenium/”);
selenium.type(“x-auto-4”, “Gopalan”);
selenium.type(“x-auto-5”, “test@test.com”);
selenium.click(”//img[contains(@src,‘http://extjs.com/playpen/gxt/selenium/images/default/shared/clear.gif’)]”);
selenium.click(”//div[@id=‘x-auto-9’]/img”);
selenium.click(”//div[@id=‘x-auto-29’]/table[3]/tbody/tr[3]/td[4]”);
selenium.click(”//div[@id=‘x-auto-29’]/table[3]/tbody/tr[4]/td[4]/a/span”);
selenium.click(”//div[@id=‘x-auto-10’]/img”);
selenium.click(”//input[@value=‘Classical’]”);
selenium.type(“x-auto-22”, “test”);
}
}
When i run this test in RC with *iehta(internet explorer(both v 6 & 7)), selenium is not recognising the objects.
The following error is thrown
om.thoughtworks.selenium.SeleniumException: ERROR: Element x-auto-4 not found
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:73)
at com.thoughtworks.selenium.DefaultSelenium.type(DefaultSelenium.java:190)
at com.testscripts.GoogleTest.test7(GoogleTest.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:71)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Gopalan
3 years agoHi,
The above problem got solved by uninstalling firefox 3 and installing the version3. Now i am getting differnt issue.
I ran the test sucessfully in firefox using the Selenium RC. But when i change this to internet explorer, one of the save button is recognised differently. I Viewed DOM Object and it is giving different name(ie ext-gen-84 for IE and ext-gen-85 for firefox). At the code level, even the DOM object is not giving the ID or name for button, even at the code level it is given. The same is working fine for textfields and others.
Any workaround for this?
One more problem: My Tests are not running in normal mode for internet explorer. It is working only in proxyinjection mode.
Taxaw
3 years agoSmarek post is very interresting.
I think that a lot of people pass through it but should take a look at the framework proposed by him.
If you want to test in a professionnal way, his framework is a key.
“
smarek
Posted on November 4th, 2008 at 3:59 pm
We started to use Selenium couple of months ago. Now I’m co-developing simple framework for testing web application. Especially for testing ExtJS application but not only.
Our testing framework uses Selenium and TestNG. 4 days ago the project was published on Google Code
KDEV-WTF
http://code.google.com/p/kdev-wtf/
To make manipulation easier the concept of adapters were used. So far the frame work is used for 3 projects and it seems to work fine (for our purposes)
If someone is interested please take a look at project page. The more information will be addad asap.
“
alikos
3 years ago????? ??????? ?????????? ?????? ??????. (? ??????? ? ??? ???-?????? – ??? ???????)
söve
3 years agothanks.
Gopalan
3 years agoThe following are the progress.
1. For the Textbox and other controls IDS has been set at the code level and this problem got solved. In case of button, even id has been set, only auto generated ids are coming to the DOM. We have solved this problem by clicking button contains text. so this will be common for all the browsers.
Now we are facing the problems. Any one has solutions?
1. Unable to click a link in the Grid list page. I have tried all the possible options listed out. In case of plain page it is working. But in case of EXTJS, selenium is not able to click the link. It is reporting element not found. We have tried expath, id, linkname, div contains, link contains, class etc.
2. DHTML based popup(Movable) windows which has only DIV and Classes for the elements to pickup.
3. Grid Editing.All the rows of a column is having the same class and id.
Gopalan
3 years agoThe problem here is Selenium is introducing the JavaScript errors. When the operation is performed manually, system is not throwing any javascript error. But in case is executing the selenium scripts, javascript errors are displayed. We suspect the javascript which is injected by the selenium is clashing with exsting js files available in the application page, which uses EXTJS.
Any best practice of avoiding these javascript errors or workaround for this problem?
MichaelC
3 years agoWe used Selenium for basic testing, worked well. it took some work.
Issue we found within EXTJS
the grid is the most used component you will have but id’s within a grid are autogenenrated. to select an element in the grid we used the actual value shown in the grid cell example: selenium.mouseOver(”//div[contains(text(),‘E-admin_VR18’)]”);
Timing is a big issue adding a wait does not really cover the issue.
better to build a loop
for i in range(60):
try:
if sel.is_element_present(“AWMEL21_4”): break
except: pass
time.sleep(1)
else: self.fail(“time out”)
The HTML version is quick but in the long run will not give you the results you will need. Both the Java and Python version seem very functional.
The IDE will generate an excellent start point, but it is only a start point.
sufiya
3 years agoi have got a same problem with auto generated ids differ for different browser.
Any solution so far
Do we have any progress on below comment(or we should still depend on a auto generated ids)
Some time ago I proposed that ExtJS support an additional config property on all widgets so that a meaningful prefix can be applied to all HTML control DOM elements that are generated by the widget. Generated ids would then be stable and meaningful so that recorded tested are readable and maintainable. Yes, you can painfully rewrite each recorded rule to use an xpath or CSS selector but this costs valuable time. It would be so much simpler and quicker to use Selenium if it’s recorded coded that uses ids *just worked*.
DJ
3 years agoUsing the uimapping for uielements in your testing seems to make testing for Ext Js a little more manageable, and it also makes the IDE more useful.
Once you build your map file, you can use it in both your java tests, and the IDE, and suddenly the IDE is returning locators that you can actually use. (If you have defined the element in the ui map)
Ui Elements have been available in the IDE since June, and were just merged into RC this month.
Buy amoxicillin without prescription.
3 years agoBuy amoxicillin….
Buy amoxicillin without prescription. Buy amoxicillin online cheap amoxicillin….
???????
3 years ago??? ???????? ???????????????, ?? ??? ??????? ??? ?? ???????????? ????? ??????? ?????? ????? ????????? ?????.
MichaelC
3 years agoI see several post issues about ID, the answer is to define the id for the component.
you need to have a good naming standard so your id’s are unique.
Grids are a problem here, I don’t have a real good answer, would love to hear one.
with grids I go for the context within the grid element an example //div[contains(text(),‘E-admin_VR18’)]
Riri
3 years agoHi,
I am using Selenium together with FitNesse to test our EXTJS application.
Results are really good !
To solve the pbl of IDs, we took a “naming convention” for all objects we can change programmaticaly the ID.
For the grid element, we took another way.
Before runing the test, when the grid is loaded, I “convert” all needed grid IDs and replace them by my own values.
The starting point I choose is the “x-grid3-viewport”. After that, all subdiv (header, body, ...) get a “temporary id” (setted using “selenium.assignId()”).
And then, the life is easy !
srinivas
3 years agoHi,
I am unable to click on a Collapse/Expand Node (’+’) using Selenium (Java). The icon is placed in a Div which is placed in a Table. Please help! Following is the UI Definition for the element
<a>
srinivas
3 years ago*
*
*
*
*<a>
*
*
*
*
srinivas
3 years agoTable-td-DIV-Span-a id=“a_id”
srinivas
3 years agoThe script could identify the element. This was confirmed using ‘isElementPresent’ and i could get the title for the Element. But unable to click on the element. Please help me in this regard. Thanks
Riri
3 years agoHi “srinivas”,
I haven’t succeed to perform this test too….
My workaround is to go into the DOM to set the value.
“this.browserbot.findElement(‘id=” + idAttr + “‘).setAttribute(‘className’, ’” + classAttr + “‘)”;
Where ‘classAttr’ is either “x-grid-group-collapsed” or “”. (Don’t forget to keep before the other value of the @class argument.
After you perform a “selenium.getEval(...) and your row is expanded or collapsed.
I know that using this, you don’t really test the “click” on the “expand icon”, but as it doesn’t work (as you indicate), this workaround allows you to do what you want in your test.
Hope it help.
srinivas
3 years agoHi Riri,
Many thanks for the solution. Actually, I am new to Selenium. Could you please help me with the code you have shared. I tried to run my script using the above code. But i ran into a errors. Please let me know incase I am missing anything
“.......objSel.getEval(this.browserbot.findElement(’@id=” + idAttr + “‘).setAttribute(’@className’, ‘“+ classAttr + “‘)); .........”
Please help
Many Thanks Again ,
Srinivas
Srinivas
3 years agoI also tried the following code
“............String childSpanTextSnippet = “(” + “this.browserbot.findElement(‘id=elem_id’).setAttribute(‘className’,’‘);”+”)”;
objSel.getEval(childSpanTextSnippet);..............................”
Go the following error
“..........-junit.framework.AssertionFailedError: test Could not be run because of com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: missing ) in parenthetical…..”
Please let me if I am missing anything
Thanks,
Srinivas
Riri
3 years agoHi again Srinivas,
1/. If you want to know if a group is expanded or not, you have first to do :
” selenium.getAttribute(path + “@class”); “, where path is the xPath to your group.
Then check if the class contains “x-grid-group-collapsed”.
2/. If you want to simulate the expand/collapse, you have to set the ‘@class’ of your group by adding or removing “x-grid-group-collapsed”. To do it use
String domLocator = “this.browserbot.findElement(‘id=” + idAttr + “‘).setAttribute(‘className’, ’” + classAttr + “‘)”;
selenium.getEval(domLocator);
Hope it help.
srinivas
3 years agoHi Riri,
Many Thanks for the help , I ran the code and it modifies the class of the node. but does not expand the node, the action required after expanding the node does not happen.
“............ selenium.getEval(”[removed]{this.page().findElement(‘id=elem_id’).setAttribute(‘class’, ‘expanded_state’);}”); .................”
Actually, there are a few fields which are hidden when the node is in a Collapsed state., I will be able to see these fields only after the node is expanded….
Please help if you have any other ides…
Many Thanks Again,
Srinivas
Julianna
3 years agoi dont usually comment, but after reading through so much info i had to say thanks
Lindsay
3 years agoI just wrote an article on how we’ve been testing an ExtJS GUI in Java at:
http://www.neocoders.com/portal/articles/selenium-and-extjs
Primarily, it describes how we got around having to assign hand-crafted IDs to all the Ext components and how we synchronise the tests with AJAX.
hope it helps somebody,
Lindsay
Balaji.R
3 years agoimport com.thoughtworks.selenium.Selenium;
import com.thoughtworks.selenium.DefaultSelenium;
public class MySelenium {
static Selenium browser;
public static void main(String arg[])
{
browser = new DefaultSelenium(“localhost”,
4444, “*firefox”, “http://172.16.0.143:8080/nevadabisqa”);
browser.start();
browser.open(“http://172.16.0.143:8080/nevadabisqa”);
browser.windowMaximize();
browser.waitForPageToLoad(“3000”);
browser.type(“userName”, “admin”);
browser.type(“password”, “C!om1@ver9e”);
browser.runScript(”[removed]document.forms[0].submit()”);
browser.waitForPageToLoad(“3000”);
browser.open(”/nevadabisqa/manageReports.do?method=loadReport”);
browser.waitForPageToLoad(“5000”);
browser.mouseOver(”//div[@class=‘gwt-PushButton mp-lookup gwt-PushButton-up’]”);
browser.mouseDown(”//div[@class=‘gwt-PushButton mp-lookup gwt-PushButton-up-hovering’]”);
browser.mouseUp(”//div[@class=‘gwt-PushButton mp-lookup gwt-PushButton-down-hovering’]”);
browser.click(”//html/body/div[2]/div/table/tbody/tr[1]/td[2]/div/div/table/tbody/tr/td[2]/img”);
}
}
The above program i am running , but inside GWT popup images not able to record it shows the error as ERROR: Element //html/body/div[2]/div/table/tbody/tr[1]/td[2]/div/div/table/tbody/tr/td[2]/img not found .... please help me out its very urgent
js
3 years agoAny tips on selenium testing with an editable grid.
I’m finding it hard to simulate the user typing values into fields of an editable grid. Is there a solution to this without having to use the core Ext API to set values?
Ibarra
3 years agoI think the problem stems from ExtJS just not allowing the element ID to be set. Yes, it does set the ID of the higher level element (example a table or a div), but that is not the one selenium would require to locate this specific element.
RIght now I had to resolve this by using XPATH, result is ugly but it works. ExtJS needs to resolve this.
Freefonty
3 years agoNice, but write more about testing, its interesting!
selguy
3 years agoGopalan,
How did you solve the problem of javascript errors being thrown during execution of selenium scripts? I am facing similar problem, where in we are getting ‘Javasctipt not enabled on your browser’ error though JS is enabled on Firefox. This does not appear if executed manually.
Thanks in advance,
selguy
kabin
3 years agothank you very nices. ok :d
wasting time
3 years agoThis little article is great and all, but it didnt save me from wasting tons of time trying to set up selenium tests for things like grids. Or for things like combo boxes or filtering or paging. Seems to be some fundamental underlying EXTJS stuff that makes certain selenium tests almost impossible to write. I think this is the first serious downside for EXTJS that I have come across. As of now, I will waste a lot of time fooling with selenium tests for extjs. And due to the crazy workarounds you have to put in place, the tests are now really brittle. So that means more wasted in the near future.
cinsellik
3 years agoI am grateful to you for this great content.
Mark
3 years agoNice article.
Tried the test and selecting combo box items doesn’t work. Plus it seems that the provided Java code is outdated.
I have the same sentiments as “wasting time.” For some cases, it’s extremely difficult to test GXT using Selenium. Context Menu does not appear with contextMenu/At; can’t select combo box items using click/At; etc. I hope you can come up with an article discussing these issues and suggesting good workarounds. Right now, writing tests for these cases is a lot of trouble.
Rajini
3 years agoHi,
I’m started learning selenium please reffer some best site where I could get java support code not javascript to practice selenium
Thanks
Rajini
Gabriel
3 years agoDon’t waste your time, selenium is no compatible with ext-gwt
Fredrik Wendt
3 years agoHi. Interesting to blog about the worst part of Ext JS - because it is.
This blog post is almost one year old. Papers were submitted to the Ext JS conference in April - zero (0) topics touched on automated testing (with Selenium). There’s no doubt that Ext JS is the strongest competitor when developing large (huge) Ajax applications.
The team I’m at have written ~25000 lines of JavaScript code. The full GUI consists of one HTML page and the rest is a close to traditional desktop client application. We’ve extensively used Selenium to drive “acceptance” test and for the most part wrote small wrapper classes around Ext base classes like Button, Menu, MenuItem etc making minor modifications to the templates in order to use ID:s that doesn’t change as soon as the design guys makes up their mind (again and again). (xpath is just too slow in IE to be used in real projects with hundreds of test cases, unless you’re fine with running test suites once a day and hiring monkeys to manually click the “This script is too slow” dialog ...)
I really hope that the Ext developers stopped ignoring this issue and not only focused on making the best framework available, but also the one being most testable.
LiR
3 years agoInstead of using
“//input[@name=‘company’]”
you can also use locator
“company”
Shruti
3 years agoHi,
Please let me know if there is a solution to the problem of dynamic ids in a GWT ext application ? How can they be handled .
thanks,
Shruti
Red56
3 years agoGet out of your kids way, relax, let them be kids and watch them grow & flourish. ,
kapadokya
2 years agoCurrently ExtJS generates unique but meaningless id’s on DOM elements. By default, Selenium IDE uses these id’s when auto recording events on HTML control elements (buttons, fields etc). Add a new widget on the page and the test script recordings all break.
Some time ago I proposed that ExtJS support an additional config property on all widgets so that a meaningful prefix can be applied to all HTML control DOM elements that are generated by the widget. Generated ids would then be stable and meaningful so that recorded tested are readable and maintainable. Yes, you can painfully rewrite each recorded rule to use an xpath or CSS selector but this costs valuable time. It would be so much simpler and quicker to use Selenium if it’s recorded coded that uses ids *just worked*.
sagsagar
2 years agoHow extjs objetcs catch in qtp or any automation testing tool?
HID Kit
2 years agoThanks very good post and no doubt this is the best blog.
shr1975
2 years agoSAHI is a web application test automation tool. It is on similar lines as Selenium, but I found it to be much better as compared to Selenium in that it takes care of the random, unique ids.
When working with Selenium, what I experienced was that it did not work with menus(the sub-menus were not being shown as the mouseOver was not being trapped) and context-menus. That was a big negative point for us.
We found SAHI much better than Selenium on these counts; we were able to record the steps right from logging in, to opening a particular screen through the menu, to entering different oombinations of data, to saving them and finally re-opening the screen all without a hitch.
Here’s the URL:
http://sahi.co.in/w/sahi
kapadokya
2 years agovery good blog thanks for web..
dratak
2 years agoIn case anyone is using a the gxt grid with check boxes and is trying to get selenium to simulate checking the check boxes the following worked:
mouseDownRight
//div[contains(text(),‘Some Text’)]
mouseUpRight
//div[contains(text(),‘Some Text’)]
You should only have to replace ‘Some Text’ with the text in one of the columns in the row you want selected
mohan
2 years agohi use sahi to test extjs and gwt application..
http://sahi.co.in
Jay
2 years agoHello everyone,
Sample website given in this blog “http://dev.sencha.com/playpen/gxt/selenium/”, can some one help me if i want to validate tool tips how should i validate. I want to capture tool tip texts and cross check my validations accoridngly. Please help me.
thanks,
Jay
Jacob
1 year agoIt has now been 2 years since this thread started. Still no interest from Sancha to the auto generated IDs issue. Our company has built a huge application around ExtJS. Our ability to bring the application to market has been greatly hindered by our inability to conduct automated testing of the app’s GUI due to the IDs issue.
Our application’s back-end is rock solid because we have a sophisticated test environment that conducts randomized testing of the back-end logic but we are having a heck of a time bringing closure to the GUI. We can’t hire enough people to test the app in a reasonable time. By the time we finish one test cycle GUI changes have already broken something else.
And so it goes, no closure in sight ...
lucassus
1 year agoSome examples of testing extjs with selenium you could find in my project https://github.com/lucassus/rwiki (see folder features)
For writing selenium test I’m using capybara + cucumber.
I have some some problems with writing test for the TreePanel drag and drop. Does somebody found good solution for writing d’n'd tests in selenium?
siyah mermer
1 year agoYou wouldn’t spend time developing custom software solutions where you could use something a lot of mistakes along the way. So, when they build it the second time, the third time, the fourth
hubsidschucky
1 year agoexcelente escrita, Uteis e a ponto Grande partes, otimo conteudo, muito realmente util para nos…obrigado.
hayvanc?l?k
1 year agoimportant topic with the weight of history and the whole administration behind it and then come up with something this limited is disappointing.
devlet hastanesi randevu
1 year agoI’ve focused our attention on Selenium as both Ext JS and Ext GWT and benifit from this “black box” testing methodology.
adwords
1 year agosuskun soft adwords reklam hizmetleri kaliteli reklam az maliyet
Andrew
1 year agoLook like, Selenium, can not record action in area chart (ExtJS) . I am unable to record some action are chart line
Albion
1 year agoHi all,
I tried to execute a Selenium testing on a remote host. But every time it’s executed, it will show error message, Unknown command: ‘setAttribute’ . Can you help me to remove that particular command? I don’t know which class access that method
Rocha
1 year agoI can’t set id on the elements in inside of a combobox, how can I do with GWT?.
Lukas
1 year agoHow in Selenium to select a row in the grid for ext js application?
The Selenium IDE does not record anything when I do clicks on the grid/table, and even if it records something it doesn’t select the row.
Henio Junior
12 months agoIn the line
selenium.type(“scLocator=//DynamicForm[ID=\“Form\”]/item[name=username||title=Username||index=0||Class=TextItem]/element”, name);
Why JUnit not recognize the type scLocator?
Ruben
9 months agowe’re struggling with testing a extgwt treegrid with selenium. Has anybody ever achieved this? The problem we’re encountering is that we can’t find a way to actually select a row, then expand it and select a child of the row. Any help appreciated.
Comments are Gravatar enabled. Your email address will not be shown.
Commenting is not available in this channel entry.