QA/Execution/Web Testing/Selenium Guidelines: Difference between revisions

no edit summary
No edit summary
Line 9: Line 9:
* Locating elements
* Locating elements
** xpath: for elements that have dynamically generated xpaths use 'contains'.
** xpath: for elements that have dynamically generated xpaths use 'contains'.
          for e.g. if xpath for 'remove add-on' link has the add-on ID  
for e.g. if xpath for 'remove add-on' link has the add-on ID  
          in it (id('addon-2464')/a[1]) and we do not know the add-on ID then
in it (id('addon-2464')/a[1]) and we do not know the add-on ID then
          we can write the xpath with 'contains'
we can write the xpath with 'contains'
          //div[@id,'addon-2464'][2]/a[1]) => //div[contains(@id,'addon- ')][2]/a[1]
//div[@id,'addon-2464'][2]/a[1]) => //div[contains(@id,'addon- ')][2]/a[1]
** If you want to match on the text in an element
** If you want to match on the text in an element
//a[text()=’My Text’]: matches a link whose text is “My Text”  
//a[text()=’My Text’]: matches a link whose text is “My Text”  
169

edits