|
602 | 602 | - Note that `:active` conflicts with this usage and therefore you
|
603 | 603 | cannot search for a keyword named `:active` and expect to find an element
|
604 | 604 | with ID equal to \"active\". In this case, use `{:id \"active\"}`.
|
605 |
| - - an XPath expression: |
606 |
| - - `\".//input[@id='uname']\"` |
| 605 | + - a string that contains either an XPath or CSS expression, depending on the |
| 606 | + driver's locator setting. Defaults to XPath. |
| 607 | + See [[use-css]], [[with-css]], [[use-xpath]], [[with-xpath]] for methods |
| 608 | + changing the driver's locator setting. |
| 609 | + - XPath: `\".//input[@id='uname'][@name='username']\"` |
| 610 | + - CSS: `\"input#uname[name='username']\"` |
607 | 611 | - a map with either `:xpath` or `:css`:
|
608 | 612 | - `{:xpath \".//input[@id='uname']\"`}`
|
609 | 613 | - `{:css \"input#uname[name='username']\"}`
|
610 | 614 | - any other map is converted to an XPath expression:
|
611 | 615 | - `{:tag :div}`
|
612 | 616 | - is equivalent to XPath: `\".//div\"`
|
613 |
| - - multiple of the above (wrapped in a vector or not). |
614 |
| - The result of each expression is fed into the next. |
615 |
| - - `{:tag :div} \".//input[@id='uname']\"` |
616 |
| - - `[{:tag :div} \".//input[@id='uname']\"]` |
| 617 | + - multiple of the above (wrapped in a vector or not). |
| 618 | + The result of each search anchors the search for the next, |
| 619 | + effectively providing a path through the DOM (though you do not |
| 620 | + have to specify each and every point in the path). |
| 621 | + - `{:tag :div} \".//input[@id='uname']\"` |
| 622 | + - `[{:tag :div} \".//input[@id='uname']\"]` |
| 623 | + Returns the final element's unique identifier, or throws if any element |
| 624 | + is not found. |
617 | 625 |
|
618 |
| - Returns the found element's unique identifier, or throws when not found. |
619 |
| -
|
620 |
| - See [Selecting Elements](/doc/01-user-guide.adoc#querying) for more details. |
| 626 | + See [Selecting Elements](/doc/01-user-guide.adoc#querying) for more details. |
621 | 627 |
|
622 | 628 | Makes use of:
|
623 | 629 | - https://www.w3.org/TR/webdriver2/#dfn-get-active-element
|
| 630 | + - https://www.w3.org/TR/webdriver2/#dfn-find-element |
624 | 631 | - https://www.w3.org/TR/webdriver2/#dfn-find-element-from-element"
|
625 | 632 | ([driver q]
|
626 | 633 | (cond
|
|
0 commit comments