1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    16
    Vote Rating
    0
    p.v.param is on a distinguished road

      0  

    Default Problem with Selenium

    Problem with Selenium


    Hello Expert's,

    I'm unable test the extjs using Selenium, Each time the extjs application is creating new ids. Any Idea please let me know waiting for great response
    Cheers
    PVP

  2. #2
    Sencha User michaelc's Avatar
    Join Date
    Dec 2007
    Location
    Bay Area - CA
    Posts
    507
    Vote Rating
    0
    michaelc is on a distinguished road

      0  

    Default


    I found the same issue, decided I need to look around for another product to do regression testing with. simple test failed with any grid component because id's for elements change from run to run.

  3. #3
    Ext User
    Join Date
    May 2007
    Posts
    10
    Vote Rating
    0
    kris is on a distinguished road

      0  

    Default


    I had the same issue with <2.0.2 and QuickTips. It was fixed in 2.1.

  4. #4
    Ext User
    Join Date
    Apr 2008
    Posts
    16
    Vote Rating
    0
    p.v.param is on a distinguished road

      0  

    Default


    Hello Kris, Still i'm facing the same probelm with for 2.1 also
    Cheers
    PVP

  5. #5
    Ext User
    Join Date
    May 2007
    Posts
    10
    Vote Rating
    0
    kris is on a distinguished road

      0  

    Default


    I thought that you referred to generating new ids as a result of 'mouseover' event (caused by quicktips in 2.0.2).

    If want to use IDs as a selector for your ui widgets in selenium, you have to specify ID for each component explicitly when you create this component. I think that this is a good practice anyway.

    from Component api doc:
    "id:String - The unique id of this component (defaults to an auto-assigned id)."

  6. #6
    Ext User
    Join Date
    Apr 2008
    Posts
    16
    Vote Rating
    0
    p.v.param is on a distinguished road

      0  

    Default


    Thank you Kris, can we give our own id to each div tags generated by extjs. if yes , how? than extjs is compaitable with Selenium.
    Cheers
    PVP

  7. #7
    Ext User
    Join Date
    May 2007
    Posts
    10
    Vote Rating
    0
    kris is on a distinguished road

      0  

    Default


    You can assign your predefined ID to any extjs component (Panel,Button,TextField etc) - and it will appear in DOM - but not to each generated div.

    I guess you're using Selenium IDE to record your tests. It is a useful tool, but you shoudn't rely on auto-generated selectors, because Selenium IDE always takes ID selector first, of course when ID exists. That will work for, let say, TextField (you can specify ID), but doesn't make sense for tags with auto-assigned IDs. I would use xpath selector that contains parent component ID instead. For example to click window maximize button (extjs desktop demo):

    //div[@id='grid-win']//div[@class='x-tool x-tool-maximize']

    To be clear, I do not feel very comfortable with this solution either, but I hope that new selenium feature, UI-Element locators, will solve this problem in more elegant way.

    Regards.

  8. #8
    Sencha User deanoj's Avatar
    Join Date
    Mar 2008
    Location
    Yorkshire, England.
    Posts
    183
    Vote Rating
    0
    deanoj is on a distinguished road

      0  

    Default


    I haven't got round to testing the grid yet, but I guess it has some similiar problems to the combobox.

    So far I have used two approaches to getting round the auto-id problem.

    The first thing I did was to extend the combobox, overriding the initList method so I could specify an explicit Id to set the 'inner-list' to.

    And to overcome the issue with the trigger I simply used an Xpath expression...in my case this was:

    PHP Code:
    selenium.click("//input[@id='make-combo']/following-sibling::img"); 
    which in the above case 'clicked' the trigger attached to a combo with the id: make-combo.

    Hope this helps...I will be approaching the grid in the next couple of weeks and will post any solutions I find.

    Deano

  9. #9
    Ext JS Premium Member
    Join Date
    Mar 2007
    Posts
    70
    Vote Rating
    0
    CableDawg is on a distinguished road

      0  

    Default


    I would advise you to stay away from XPATH selectors and stick with CSS selectors.

    Selenium's XPATH implementation for IE6 is horrendously slow and will kill the browser.

    I use Selenium everyday with a rather large Ext based application and have no problems using it. If something doesn't have an ID, CSS selectors will work just fine.

    Selenium uses CSSQuery under the hood, so Google that or "CSS selectors" for the proper syntax.

    For example:
    Code:
    selenium.click("//input[@id='make-combo']/following-sibling::img");
    would become:
    Code:
    selenium.click("css=#make-combo + img");
    and
    Code:
    //div[@id='grid-win']//div[@class='x-tool x-tool-maximize']
    would become:
    Code:
    css=#grid-win div.x-tool.x-tool-maximize

  10. #10
    Sencha User deanoj's Avatar
    Join Date
    Mar 2008
    Location
    Yorkshire, England.
    Posts
    183
    Vote Rating
    0
    deanoj is on a distinguished road

      0  

    Default


    Thanks for the advice I will take heed.