0

I am doing an acceptance test using watir-webdriver using ruby I wanna ask if watir webdriver is support for ExtJs or not? I am trying to find element that generated dynamically by ExtJS. I am trying doing some thing like

@browser = Watir::Browser.new :chrome
#Some step go to page
@cbo = @browser.execute_script "return Ext.getCmp('cboCategory')"

but It didn't work Please give me some advises. Thank you.

Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
TienHoang
  • 21
  • 1
  • 6
  • It would help to be more specific about what you are trying to do - ie give an actual example. ExtJS has quite a number of features, which means a general response might not be useful. If your page is not available to the public, then consider giving an example that does not work from the [ExtJS webpage](http://www.sencha.com/products/extjs/examples/) – Justin Ko Oct 02 '13 at 12:43

1 Answers1

1

ExtJS pages are hard to test, especially on finding elements.

Here are some of the tips I consider useful:

  • Don't ever use dynamically generated IDs. like (:id, 'ext-gen1302')
  • Don't ever use absolute/meaningless XPath, like //div[4]/div[3]/div[4]/div/div/div/span[2]/span

  • Take advantage of meaningful auto-generated partial ids and class names.

    For example, this ExtJS grid example: (:css, '.x-grid-view .x-grid-table') would be handy. If there are multiple of grids, try index them or locate the identifiable ancestor, like (:css, '#something-meaningful .x-grid-view .x-grid-table').

  • Create meaningful class names in the source code. ExtJS provides cls and tdCls for custom class names, so you can add cls:'testing-cmb-category' in your source code, and get it by (:css, '.x-panel .testing-cmb-category').

Other answers I made on this topic:

Community
  • 1
  • 1
Yi Zeng
  • 32,020
  • 13
  • 97
  • 125