-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGoogleSearchPage.txt
40 lines (33 loc) · 1.64 KB
/
GoogleSearchPage.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| *** Setting *** | Value |
| Documentation | Page Object as Resource File Example for Robot Framework |
| Library | Selenium2Library |
| *** Variable *** | Value |
| ${SEARCH_FIELD} | name=q |
| ${SEARCH_BUTTON} | name=btnG |
| *** Keyword *** |
| Click On Search |
| | [Documentation] | Click the search button to proceed with the search |
| | Selenium2Library.Click Button | ${SEARCH_BUTTON} |
| Close |
| | [Documentation] | Close the browser window |
| | Selenium2Library.Close Browser | # or is it Selenium2Library.Close Window? |
| Get Title |
| | [Documentation] | Get the page title for Google search page |
| | ${result} = | Selenium2Library.Get Title |
| | [Return] | ${result} |
| Open |
| | [Arguments] | ${url} |
| | [Documentation] | Open (or go to) the Google search page |
| | Run Keyword And Return If | ${BROWSER_OPENED} == ${true} | Selenium2Library.Go To | ${url} |
| | Selenium2Library.Open Browser | ${url} | ${BROWSER} | #other optional args |
| | ${BROWSER_OPENED} = | Set Variable | ${true} |
| Search For |
| | [Arguments] | ${searchTerm} |
| | [Documentation] | Perform a search on Google (enter search text, then click search) |
| | GoogleSearchPage.Type Search Term | ${searchTerm} |
| | Sleep | 1 seconds | Arbitrary delay for page load and action to take effect correctly in automation |
| | GoogleSearchPage.Click On Search |
| Type Search Term |
| | [Arguments] | ${searchTerm} |
| | [Documentation] | Enter search term into Google search field. This doesn't click the search button as a follow up. |
| | Selenium2Library.Input Text | ${SEARCH_FIELD} | ${searchTerm} |