Code libraries for AMO pages: Difference between revisions

no edit summary
No edit summary
Line 13: Line 13:
...'''_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.  


...'''_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. see ''Locators that require a parameter'' below.


Example: <br>  
Example: <br>  


*addonCategoryLandingPage_RecentList['title'] is a locator to the title of the Recent list on the add-on category landing page<br>  
*''addonCategoryLandingPage_RecentList['title']'' is a locator to the title of the Recent list on the add-on category landing page<br>  
*addonCategoryLandingPage_RecentList_Item['name'] % 3 creates a locator to the name of the 3rd add-on in the same list<br>
*''addonCategoryLandingPage_RecentList_Item['name'] % 3'' creates a locator for the name of the 3rd add-on in the same list<br>


<br>
<br>
=== Locators that require a parameter ===
Some locators require a parameter to complete them.  They contain '%s' and must be followed by " ''% value''", where ''value'' is a literal or variable.  Sometimes the parameter is an index into a list.  In other cases it is a variation within a set of similar locators.
'''Locators that require an index'''
*Example: addonName = get_text( AMOlocators.addonBrowsePage_List_Item[name] '''% AddonIdx''' ) #  retrieves the text for the name for the item # specified by AddonIdx. The list is on the add-on browse page.<br>
*all locators in the ..._List_Item[ ] dictionaries require an index.
*dictionary keys that end in ''Indexed'' require an index.
'''Locators that require a key value'''
* Example: sel.click ( AMOlocators.addonHomePage_List['sortLinkKeyed'] '''% sortOption''' ) clicks on a link that contains a[contains(@href,'?featured=popular')] or a[contains(@href,'?featured=updated')], and sortOption contains the value string 'popular' or 'updated', respectively.
* dictionay keys that end in 'Keyed' require a key value


=== Naming conventions for dictionary keys ===
=== Naming conventions for dictionary keys ===
Line 85: Line 67:


'''*Indexed'''
'''*Indexed'''
*Locator requires a parameter in order to index into a list.  see ''Locators that require a parameter'' above.
*Locator requires a parameter in order to index into a list.  see ''Locators that require a parameter'' below.


'''*Keyed'''
'''*Keyed'''
*Locator requires a parameter to specify a locator with a set of similar locators.  see ''Locators that require a parameter'' above.
*Locator requires a parameter to specify a locator with a set of similar locators.  see ''Locators that require a parameter'' below.
and many more  
and many more  


<br>
=== Locators that require a parameter ===
Some locators require a parameter to complete them.  They contain '%s' and must be followed by " ''% value''", where ''value'' is a literal or variable.  Sometimes the parameter is an index into a list.  In other cases it is a variation within a set of similar locators.
'''Locators that require an index'''
*Example: addonName = get_text( AMOlocators.addonBrowsePage_List_Item[name] '''% AddonIdx''' ) #  retrieves the text for the name for the item # specified by AddonIdx. The list is on the add-on browse page.<br>
*all locators in the ..._List_Item[ ] dictionaries require an index.
*dictionary keys that end in ''Indexed'' require an index.
'''Locators that require a key value'''
* Example: sel.click ( AMOlocators.addonHomePage_List['sortLinkKeyed'] '''% sortOption''' ) clicks on a link that contains a[contains(@href,'?featured=popular')] or a[contains(@href,'?featured=updated')], and sortOption contains the value string 'popular' or 'updated', respectively.
* dictionay keys that end in 'Keyed' require a key value
<br>
<br>
<br>


1,072

edits