-
Notifications
You must be signed in to change notification settings - Fork 784
Expand file tree
/
Copy pathcreate_webdriver.robot
More file actions
52 lines (47 loc) · 2.7 KB
/
create_webdriver.robot
File metadata and controls
52 lines (47 loc) · 2.7 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
*** Settings ***
Documentation Tests Webdriver
Resource resource.robot
Library Collections
*** Test Cases ***
Create Webdriver Creates Functioning WebDriver
[Documentation]
... LOG 1:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver.
... LOG 1:18 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+.
[Tags] Known Issue Internet Explorer Known Issue Safari SKIP_ON_WINDOWS
[Setup] Set Driver Variables
Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS}
Go To ${FRONT_PAGE}
Wait Until Page Contains needle 5s
[Teardown] Close Browser
Create Webdriver With Bad Driver Name
[Documentation] Invalid browser name
Run Keyword And Expect Error 'Fireox' is not a valid WebDriver name.
... Create Webdriver Fireox
Create Webdriver With Duplicate Arguments
[Documentation] Invalid values in arguments
${kwargs}= Create Dictionary arg=1
Run Keyword And Expect Error Got multiple values for argument 'arg'.
... Create Webdriver Firefox kwargs=${kwargs} arg=2
Create Webdriver With Bad Keyword Argument Dictionary
[Documentation] Invalid arguments types
${status} ${error} = Run Keyword And Ignore Error Create Webdriver Firefox kwargs={'spam': 'eggs'}
Should Be Equal ${status} FAIL
Should Match Regexp ${error} (TypeError: (?:WebDriver.)?__init__\\(\\) got an unexpected keyword argument 'spam'|kwargs must be a dictionary\.)
*** Keywords ***
Set Driver Variables
[Documentation] Selects proper driver
${drivers}= Create Dictionary ff=Firefox firefox=Firefox ie=Ie
... internetexplorer=Ie googlechrome=Chrome gc=Chrome chrome=Chrome
... safari=Safari headlesschrome=Chrome headlessfirefox=Firefox
${name}= Evaluate "Remote" if "${REMOTE_URL}"!="None" else $drivers["${BROWSER}"]
Set Test Variable ${DRIVER_NAME} ${name}
${dc names}= Create Dictionary ff=FIREFOX firefox=FIREFOX ie=INTERNETEXPLORER
... internetexplorer=INTERNETEXPLORER googlechrome=CHROME gc=CHROME
... chrome=CHROME safari=SAFARI headlessfirefox=FIREFOX headlesschrome=CHROME
${dc name}= Get From Dictionary ${dc names} ${BROWSER.lower().replace(' ', '')}
${caps}= Evaluate selenium.webdriver.DesiredCapabilities.${dc name}
... modules=selenium, selenium.webdriver
${kwargs}= Create Dictionary
Run Keyword If "${name}"=="Remote" Set To Dictionary ${kwargs} command_executor
... ${REMOTE_URL} desired_capabilities ${caps}
Set Test Variable ${KWARGS} ${kwargs}