PDA

View Full Version : Help with Selenium



skhealy
20 Dec 2010, 7:53 AM
Hi all,

We have a license for Ext JS 3.x and want to use Selenium to test the Web application we just finished. So I would appreciate some specific help.

First, it appears that some Ext JS components (like buttons) have wrapper elements so that the id one specifies for the component is assigned to the wrapper element rather than the component itself. As a side note, let me say this is a poor state of affairs. The id should be assigned to the component; if an id is needed for the wrapper element for functionality, then dynamically create one derived from the specified id (e.g., button-id-wrapper). That said, how do I assign an id to the actual component I'm creating (please provide a code sample)?

Second, what other Ext JS components besides buttons am I going to have this problem with? Can I have a list of such components?

Thanks much!

raskri
22 Dec 2010, 2:54 AM
I believe that selenium works fine with Ext.Buttons.

selenium->click("id=THE_ID_OF_THE_BUTTON") as the handler of the button is called.

If you want to click the BUTTON dom element just do Ext.getCmp('THE_ID_OF_THE_BUTTON').getEl().dom.id

Hope it helped.

Condor
22 Dec 2010, 4:38 AM
An Ext.Button consists of a <table> with a <button> inside it, so you should be using:

selenium->click("#<id-of-button> button")

or you could use the id of the actual <button> element:

Ext.getCmp('<id-of-button'>).btnEl.dom.id

skhealy
22 Dec 2010, 12:15 PM
Thanks, guys. One more question: how do I set the ids for buttons on a MessageBox? I was looking at the documentation and it looks like the standard way of coding message boxes doesn't facilitate this need. The reason for needing this is that we send messages back to the UI upon success or failure of an action (say saving a form), so an alert pops up and I need to have a button id to script Selenium to move past the alert. Can one use a user defined button, configured with an id, in lieu of the standard buttons in Message Boxes? And would you then use the show method for this (e.g., buttons: mybutton)?