19. Finding Elements
Identifing elements:
– identifier=id: @id/@name
– id=id: Select the element with the specified @id attribute.
– name=name: Select the first element with the specified
@name attribute.
– dom=function foo() { return document.links[1]; }; foo();
– link=textPattern
http://release.seleniumhq.org/selenium-remote/control/0.9.2/doc/dotnet/Selenium.html
20. Finding Elements
String-match Patterns
– glob:pattern:
• "*": any sequence of characters
• "?": any single character.
• Glob patterns match against the entire string.
– regexp:regexp: match a string using a regular-expression.
– exact:string: match a string exactly
21. Finding Elements (2)
Resolving strategies:
– dom, for locators starting with "document."
– xpath, for locators starting with "//"
– identifier, otherwise
22. Css Selectors
• all css1, css2 and css3 selectors (except namespaces in
css3)
– css=a[href="#id3"]
– css=span#firstChild + span
pseudo classes
– :nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type
– :visited, :hover, :active, :focus
• pseudo elements
– ::first-line,::first-letter, ::selection, ::before, ::after
• examples:
– div#id, div.class, div > p > a
– a[href=”http://www.google.com”]