Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Having trouble finding FormItems in Selenium test cases

    I am trying to add automated Selenium unit tests to my project but I am having some trouble selecting FormItems. It's easy to locate something like a TextItem since I can easily give each TextItem a unique name and then locate it with the SCLocator. However, FormItems like SelectItems and CheckboxItems don't have a name property in their generated html code so it's much more challenging for me to select them.


    Would it be possible to set the id of the form item and have it appear in the generated html code for that item?


    In other words, I would like to set an id like this...


    id=user_selection


    And have it it appear in the div for the SelectItem like this...


    <div id="user_selection" $89="isc_SelectItem_30" $9a="$9d" class="selectItemText" style="width:153px;height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:12px;" tabindex="2386" role="presentation" eventproxy="user_selection" ></div>


    And then I can find it in my Selenium test case like this....


    By userSelection = ByScLocator.scLocator("//DynamicForm[ID="login_page_dynamic_form"]/item[id=user_selection]/element;


    Is it possible for me to do this?





    #2
    You appear to know about scLocators, but for some reason you are *also* looking at the DOM. With scLocators you don't use the DOM at. Obtain a locator for the SelectItem and you can find it again, and it doesn't matter what's in the DOM.

    Comment

    Working...
    X