PDA

View Full Version : Selenium Testing A Combobox in A Gridview



slohrenz
27 Jan 2012, 1:11 PM
Hi,

My team has run into an issue when trying to automate out tests with Selenium. We are using extJS 4.0.7.

We are trying to select a value in a combobox that is in a gridview of search results. Selecting the value in the combobox triggers a bunch of events to fire and change the screen.

1. We donít know how to reference the arrow that drops down the menu, except by ID which changes whenever the page reloads, so for automated use this isn't ideal.

2. Even if I use ID, the menu doesnít populate (and thus isn't selectable) until I manually bring the browser window to the foreground (again not ideal for automation). If we canít find a way to do this, we could live with some other, automatable way to do these actions Ė hidden buttons on each row in the grid?

How have other people worked around this?

Steve

harman
13 Jun 2012, 1:48 AM
Hi,

I am also facing the same problem.
How do i select an option in ExtJS 4.0.7 combo using Selenium when there is no id with the options?

Please do reply
Thanks

Farish
23 Sep 2012, 11:20 PM
its been quite some time since this question was posted and may be you guys already found solutions. Here is how I am doing it for a combobox in the editor of rowediting plugin. After you have started editing (the combobox is now visible in the grid), here is how you open the drop-down list (by clicking on the picker):


//div[@id='my_grid']//div[contains(@class, 'field1_my_grid')]//div[@role='button']

where 'field1_my_grid' is the cls config for the combobox to help locate it in the DOM using Selenium and role='button' gets the picker (arrow) which opens and closes the drop-down list. You can also use the same logic for comboboxes in general by assigning them a css class using cls config.

23 Sep 2012, 11:39 PM
My team has run into an issue when trying to automate out tests with Selenium. ....
.....
How have other people worked around this?

Unfortunately using Selenium directly with ExtJS it's a PITA because of the lots of HTML markup ExtJS generates and the fact that this might change from version to version, thus breaking your tests (plus other issues).

Here's a better approach to the problem:
http://techblog.outbrain.com/2011/12/how-to-outbrain-selenium-tests-with-ext-framework/

The project is here:
https://github.com/asaflevy/SelenuimExtend

Unfortunately it's far from complete, but it's a good starting point.

Farish
23 Sep 2012, 11:55 PM
Thanks for your reply and the concept is nice. From what I understand, this is in Java and I am not familiar with Java. I am using Selenium IDE. Is there someway to do this for IDE?

24 Sep 2012, 12:27 AM
Thanks for your reply and the concept is nice. From what I understand, this is in Java and I am not familiar with Java. I am using Selenium IDE. Is there someway to do this for IDE?
Not really.

Unfortunately Selenium IDE is a very nice starting tool, but quite useless(or just a PITA) for more "real" or "webapp" scenarios. Think of it more as a prototyping tool.

If you are not familiar with Java, you might be able to use other Selenium supported language:
http://seleniumhq.org/docs/03_webdriver.html

but I'm afraid you would need to re-implement something like "SelenuimExtend (https://github.com/asaflevy/SelenuimExtend)" in another language. This should be quit easy since the project is very very small - alpha stage (and only a few methods do the trick actually - the concept is described in the blog article).

Another option would be to ask the original developer if he has plans to support more programming languages :), but considering that didn't updated the project for a while, .....

Farish
24 Sep 2012, 12:31 AM
then it would be better to learn some Java so that I can also benefit as SelenuimExtend develops. Thanks for the advice.

Farish
25 Sep 2012, 11:06 PM
I have set up a Java project in Eclipse and am using WebDriver. I have one question. I am using ExtJS to do some actions (e.g. clicking on a button, changing tab of a tabpanel) using executeScript. Is there any problem in this approach? What I actually want is to see the result of the actions for the application and how I click a button is not so important for me. What do you think?