1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Rep Power

    Help - css selector (testing in Selenium)


    I am a tester using selenium, and I mainly use CSS selectors.

    I have a recurrent problem to express a selector in such cases :

    <div class="rich-menu-item-icon" >Mobile Applications</div>
    <div class="rich-menu-item-icon >Applications</div>

    I don't know what the name for this "stuff" between >< (>this stuff< , in example, Mobile Applications or ApplicationS.

    This seems really simple, but as I don't find the qualifier to express this, I can express equality.
    In most cases i can use css=div:contains(value), but I sometimes need to be more precise and use equality : here if I use css=div:contains(Applications), the first div will be selected too.

    May be there is another way to do ...

    I am a tester, the html is generated by framework and developers cannot add an attribute so that I can test it.
    I did not manage to use regexp either.

    I anyone could help me, I would be very grateful

    Thanks in advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Nebraska, USA
    Rep Power
    I'm not familar with "selenium" [except to know it is also an element on the periodic table ], but, this actually looks like it may be accomplished using Javascript and using innerHTML to target what you want to target.
    I don't know alot about Javascript either as far as helping to write the code to perform your task, but, from the reading I've done and tutorials I've watched, this looks like it may be the way to go.
    Hopefully someone else with more knowledge will "chime in" and give you more to go on.

    EDIT: I decided to do some "googling" to find out about Selenium CSS Selectors and ran across THIS article that may help.
    Last edited by DonR; April 5th, 2013 at 02:34 PM.

IMN logo majestic logo threadwatch logo seochat tools logo