Testing: Selenium: ZimbraSelenium Tips
General Information
This page details some helpful tips regarding usage of the Zimbra Selenium Harness
Code
Selenium
Locators
Using the most optimal locators is crucial for cross-browser compatibility. IE is notoriously slow for processing xpath locators. As per the Selenium documentation, the preferred format of locators is:
- by Identifier (i.e. locator="DWT233")
- by CSS (i.e. locator="css=a[href='#id3']")
- by xpath (i.e. locator="//a(@href='@id3']")
xpath to css translation
xpath | css | preferred | usage |
---|---|---|---|
"xpath=//div[@id='foo']" | "css=div[id='foo']" | "foo" | sIsElementPresent("foo") |
"xpath=//div[@id='foo']" | "css=div[id='foo']" | "foo" | sIsElementPresent("foo") |
See http://saucelabs.com/blog/index.php/2010/01/selenium-totw-css-selectors-in-selenium-demystified/