1,072
edits
No edit summary |
|||
| Line 9: | Line 9: | ||
*Centralize 'best practices' for locator definition and 'tricks' to address complicated situations. | *Centralize 'best practices' for locator definition and 'tricks' to address complicated situations. | ||
<br> '''Naming convention of dictionaries''' | |||
'''Naming convention of dictionaries''' | |||
...'''_List[ ]''' references elements that appear once on a list, such as headers or sort selectors. | ...'''_List[ ]''' references elements that appear once on a list, such as headers or sort selectors. | ||
| Line 16: | Line 15: | ||
...'''_List_Item[ ]''' references elements on a particular item in a list. All keys require an index value into the list. | ...'''_List_Item[ ]''' references elements on a particular item in a list. All keys require an index value into the list. | ||
Example: <br> | |||
*addonCategoryLandingPage_RecentList['title'] refers to the title of the Recent list on the add-on category landing page<br> | |||
*addonCategoryLandingPage_RecentList_Item['name'] refers to the name on an add-on to the same list<br> | |||
<br> | |||
'''Locators that require an index value''' | '''Locators that require an index value''' | ||
| Line 24: | Line 28: | ||
Locators that require an index are named as follows: | Locators that require an index are named as follows: | ||
*all locators in the ..._List_Item[ ] dictionaries. | *all locators in the ..._List_Item[ ] dictionaries. | ||
<blockquote> | |||
Example: addonName = get_text( addonBrowsePage_List_Item[name] % idx ) retrieves the text for the name on the idx-th add-on in the list on the browse page. | |||
</blockquote> | |||
*dictionary keys that end in ''Indexed''. | *dictionary keys that end in ''Indexed''. | ||
| Line 33: | Line 40: | ||
Dictionary keys that don't end with a tag type generally refer to a section of text or a higher level node.<br> | Dictionary keys that don't end with a tag type generally refer to a section of text or a higher level node.<br> | ||
'''item'''<br> | '''item'''<br> | ||
*Dictionaries that reference a list use this key for an entire item (i.e. add-on).<br> | *Dictionaries that reference a list use this key for an entire item (i.e. add-on).<br> | ||
**_List['item'] refers tp the item node on the list without an index. Could be used with an is_element_present to check if a list contains any items. | **_List['item'] refers tp the item node on the list without an index. Could be used with an is_element_present to check if a list contains any items. | ||
<blockquote> | <blockquote> | ||
*Suitable for: get_xpath_count( ) | *Suitable for: get_xpath_count( ) | ||
*Example: itemCount = sel.get_xpath_count ( AMOlocators.addonBrowsePage_List['item'] ) | *Example: itemCount = sel.get_xpath_count ( AMOlocators.addonBrowsePage_List['item'] ) | ||
</blockquote> | </blockquote> | ||
**_List_Item['item'] refers to the item node using an index. To access a particular element on the n-th item, generally the mnemonic key for that element is used, rather than appending to this locator.<br> | **_List_Item['item'] refers to the item node using an index. To access a particular element on the n-th item, generally the mnemonic key for that element is used, rather than appending to this locator.<br> | ||
<br> | <br> | ||
'''name'''<br> | '''name'''<br> | ||
*element with the item name.<br> | *element with the item name.<br> | ||
*Suitable for sel.get_text( )<br> | *Suitable for sel.get_text( )<br> | ||
*Example: addonName = get_text( addonBrowsePage_List_Item[ | *Example: addonName = get_text( addonBrowsePage_List_Item[''name''] % idx ) retrieves the text for the name on the ''idx''-th add-on in the list on the browse page. | ||
<br> | |||
'''*Link'''<br> | '''*Link'''<br> | ||
| Line 61: | Line 68: | ||
*Example 2: sel.get_attribute( AMOlocator.addonCategoryLandingPage_TopRatedList['ViewAllLink'] + "@href" ) retrieves the href attribute from the View All link of the Top Rated list on the category landing page.<br> | *Example 2: sel.get_attribute( AMOlocator.addonCategoryLandingPage_TopRatedList['ViewAllLink'] + "@href" ) retrieves the href attribute from the View All link of the Top Rated list on the category landing page.<br> | ||
<br> | |||
<span style="font-weight: bold;">*</span>'''Select'''<br> | <span style="font-weight: bold;">*</span>'''Select'''<br> | ||
| Line 69: | Line 76: | ||
*Example: sel.select( AMO_locators.addonsSearchResults['sortSelect'], 'value=' + sortOption) selects from the add-ons search results page the sort option with the 'value' attribute specified by sortOption.<br> | *Example: sel.select( AMO_locators.addonsSearchResults['sortSelect'], 'value=' + sortOption) selects from the add-ons search results page the sort option with the 'value' attribute specified by sortOption.<br> | ||
<br> | |||
'''*Option''' <br> | |||
'''*Option''' <br> | |||
*Refers to options in a select control. The last node in the locator is an <option>. | *Refers to options in a select control. The last node in the locator is an <option>. | ||
edits