Difference between revisions of "Testing Area/Behat Testing/Selectors and Elements"
From Mahara Wiki
< Testing Area | Behat Testing
m (Anitsirk moved page Testing/Behat Testing/Selectors and Elements to Testing Area/Behat Testing/Selectors and Elements: Consolidating where testing pages sit) |
|||
(11 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | <h1>Elements and Selectors</h1> | ||
+ | Elements and selectors are used in the syntax in the steps. They help Behat identify what exactly you want it to click on. | ||
+ | * Element and Selectors are to be used in unison. An Element is the title of the selector you are using. Ie, If you need to press a button. The button is the '''Selector''' and then '''Element''' is the name of the button. | ||
+ | |||
+ | As an example: | ||
+ | |||
+ | And "$elements" "$selector" should be visible | ||
+ | |||
+ | Would be written as: | ||
+ | |||
+ | And "Create page" "button" should be visible | ||
+ | |||
+ | |||
+ | |||
+ | <h2>Elements</h2> | ||
+ | |||
+ | * Element are the title of the selector. | ||
+ | The hard one is: "css_elemet" | ||
+ | |||
+ | *For this you need to right click-> Inspect Element and then find the class or Id. Class is recognized by a full stop and ID is recognized by a #. | ||
+ | |||
+ | |||
+ | For example using the search box on the copy page or collection: | ||
+ | |||
+ | And I click on ".query-button" "css_element" | ||
+ | |||
+ | <h2>Selectors</h2> | ||
+ | |||
+ | Where ever it says "Selector" any of these forms of selectors can be used: | ||
+ | |||
+ | *dialogue | ||
+ | *block | ||
+ | *region | ||
+ | *table_row | ||
+ | *link | ||
+ | *button | ||
+ | *link_or_button | ||
+ | *select | ||
+ | *checkbox | ||
+ | *radio | ||
+ | *file | ||
+ | *filemanager | ||
+ | *optgroup | ||
+ | *option | ||
+ | *table | ||
+ | *field | ||
+ | *fieldset | ||
+ | *text | ||
+ | *css_element | ||
+ | *xpath_element | ||
+ | |||
+ | |||
+ | |||
+ | ==FAQ'S== | ||
[[Category:Behat]] | [[Category:Behat]] |
Latest revision as of 13:05, 8 June 2020
Elements and Selectors
Elements and selectors are used in the syntax in the steps. They help Behat identify what exactly you want it to click on.
- Element and Selectors are to be used in unison. An Element is the title of the selector you are using. Ie, If you need to press a button. The button is the Selector and then Element is the name of the button.
As an example:
And "$elements" "$selector" should be visible
Would be written as:
And "Create page" "button" should be visible
Elements
- Element are the title of the selector.
The hard one is: "css_elemet"
- For this you need to right click-> Inspect Element and then find the class or Id. Class is recognized by a full stop and ID is recognized by a #.
For example using the search box on the copy page or collection:
And I click on ".query-button" "css_element"
Selectors
Where ever it says "Selector" any of these forms of selectors can be used:
- dialogue
- block
- region
- table_row
- link
- button
- link_or_button
- select
- checkbox
- radio
- file
- filemanager
- optgroup
- option
- table
- field
- fieldset
- text
- css_element
- xpath_element