WI-OC-054 - Selenium Automation Project
This KB page contains all of the details of the automation project.
Purpose
- Describe the methods of using the automation program.
Responsibilities
- Application Administrator
- Tests should be run in DEV environment
- These programs SHOULD NOT be used in a production system
Instructions
- Requirements:
- For downloading the software, with the exception of the python packages, you will need to set up a meeting with DoIT to help install software.
- Need to have an IDE installed
- Visual Studio Code is an excellent choice (https://code.visualstudio.com/download)
- Need to have the most recent version of python installed (https://www.python.org/)
- If you are planning on doing software development you will also need to install GIT
- If you are just doing testing scripts then share the scripts with someone who can upload information to the project and they can add it to the scripts document.
- Need to have the browsers (Chrome and Firefox) up to date
- This can be done by finding the help menu for Chrome and then "About Google Chrome"
- From there you can update and relaunch chrome
- For Firefox this can also be done by finding the help menu and then selecting "About Firefox"
- From there you can relaunch and update Firefox
- This can be done by finding the help menu for Chrome and then "About Google Chrome"
- Need to have access to project 'OnCore Testing Automation Project' in Doit GitLab
- Need to have several python packages installed
- How to install python packages (https://packaging.python.org/en/latest/tutorials/installing-packages/)
- Packages to install
- Selenium (https://pypi.org/project/selenium/)
- Webdriver-manager (https://pypi.org/project/webdriver-manager/)
- pyyaml (https://pypi.org/project/PyYAML/)
- pytest (https://pypi.org/project/pytest/)
- Type of file to use
- Currently only using yaml files for the script records
- Structure of a document for automation
- Uses the following keywords:
- case:
- Details of the test case written
- loop:
- 'true' or 'false'
- driver:
- 'new' or 'continue'
- errors:
- Uses the following keys:
- permitted:
- scope:
- Uses the following keys:
- steps:
- Uses the following keys:
- comment:
- action:
- element:
- Uses the following keys:
- case:
- Uses the following keywords:
- Structure of errors:
- permitted:
- Provide an integer value of 0 or greater. This is the number of errors it takes for the script to no longer attempt any steps in a single yaml document
- scope:
- Currently non-functional. Should just enter 'global'
- permitted:
- Structure of steps
- comment:
- The comment describing what is done in each step
- action:
- The details of the step being performed
- element:
- The details of the element being interacted with for specific action types
- They are set up as a list. You specify a position in a list with a hyphen: -
- Under each step should be at least a comment and an action, an element is optional depending on the action
- It ends up looking like this if all 3 components are present:
- steps:
- comment: This is a comment
element:
type: xpath
value: //a[contains(text(),'Edit')]
action:
type: input
specifications:
type: click
- comment...
- steps:
- comment:
- Structure of Element
- uses the following keywords:
- type:
- This is the method that is used in locating the element
- These are the keyword options:
- id
- name
- xpath
- link_text
- partial_link_text
- tag_name
- class_name
- css_selector
- value:
- This is the value that will be used in searching for the element
- type:
- uses the following keywords:
- Structure of Action
- Uses the following keywords:
- type:
- This is the type of action to be performed
- specifications:
- This contains the details of how the action will be performed
- type:
- Uses the following keywords:
- Structure of Specifications nested under actions
- Uses the following keywords:
- type
- If there is further details needed to specify the type of action this field is used
- value
- If a value needs to be provided this field is typically provided
- For example free text if you are entering text into a form, or a number for the wait timer
- type
- Uses the following keywords:
- Types of actions and their information:
- action_chain
- Description: A type of action where you list a series of steps that are queued up and then performed
- The structure of an action chain action
- type:
- always 'action_chain'
- specifications:
- will only use the key 'value' and never use 'type' as a key
- The key 'value' will have a list nested under it
- value:
- Has a list nested under it
- Each list item will always have the keys 'type' and value'
- type:
- This is where you specify what type of action to use in the action chain
- value:
- This is where you specify the details of that action
- Please jump to the next number to see details of the types and values of actions in action_chains.
- type:
- alerts
- Description: A type of action that interacts with alerts (similar to a popup but alerts are a part of the original web-page)
- type:
- always 'alert'
- specifications:
- Must have a key of 'type' but does require a key of 'value'
- type:
- can be 'accept' which indicates you are accepting the warning
- can be 'dismiss' which means you will dismiss the warning
- can be 'alert_warning' which means you will validate the text present within the alert, you will still need to accept or dismiss it after verifying the text present
- value:
- Only used with 'alert_warning' and you should put all or a piece of the exact text you are expecting to see in the pop up. If there is not an exact match present somewhere in the popup this step will fail
- type:
- Description: A type of action that interacts with alerts (similar to a popup but alerts are a part of the original web-page)
- browser
- Description: Opens a browser of a specific type
- type:
- always 'browser'
- specifications:
- Must have a key of 'type', does not have a key of 'value'
- type:
- Can be 'chrome' which will use a chrome browser instance
- Can be 'firefox' which will use a firefox browser instance
- type:
- Description: Opens a browser of a specific type
- input
- Description: Inputs information into the web-page
- type:
- always use 'input'
- specifications:
- Must have a key of 'type', sometimes has a key of 'value'
- type:
- Here the options are:
- text, click, enter, escape, delete, backspace, tab, arrow_down, arrow_right, arrow_left, arrow_up
- With the exception of text, it inputs the key (or click) that is specified
- Here the options are:
- value:
- A value is only given if your type of input is 'text'
- You should put the text you would like entered, exactly as you would like it entered.
- type:
- Special cases
- If a value of '___random_mrn___' is used then a random number between 20,000 and 99,999 will be generated and used for the string.
- Description: Inputs information into the web-page
- quit
- Description: Closes out the open browser
- type:
- Always use 'quit'
- specifications:
- Specifications are not needed for this action
- type:
- Description: Closes out the open browser
- scan
- Description: Searches over the HTML of the web-page for specific text
- type:
- Always use 'scan'
- specifications:
- Will only have a key of 'value', do not use 'type' here
- value:
- Enter the exact text you would like found on the page separated by commas if there is more than one piece of text you would like to check for.
- type:
- Description: Searches over the HTML of the web-page for specific text
- select
- Description: Interacts with drop down menus on a web-page
- type:
- Always use 'select'
- specifications:
- Will always have both the keys of 'type' and of 'value'
- type:
- The options are: index, text, and value
- This indicates what identifier you will use for the selection in the drop down you are attempting to select
- value:
- Here you should put the exact text or number you are matching on to select your drop down option
- type:
- Description: Interacts with drop down menus on a web-page
- verify
- Description: Similar to scan, but searches for text at a specific location on the page. Recommend using scan unless there is a special case.
- Don't use this yet.
- wait
- Description: Has the automation wait a specified number of seconds
- type:
- Always use 'wait'
- specifications:
- Will only have a key of 'value' and not of 'type'
- value:
- Put an integer value
- This will be the amount of time in seconds that no actions will be taken.
- type:
- Description: Has the automation wait a specified number of seconds
- website
- Description: Navigates the web-page to a specific website
- type:
- Always use 'website'
- specifications:
- Will only have a key of 'value' and not of 'type'
- value:
- Enter the full exact URL of the web-page you would like to navigate to, including https://...
- type:
- Description: Navigates the web-page to a specific website
- windows
- Description: Can be used to switch between the main browser window and a pop-up window (different from an alert that is part of the main page)
- type:
- Always use 'window'
- specifications:
- Only has a key of 'type' and not of 'value'
- type:
- The options are: popup and main
- After a popup has been created and you would like to interact with it, use a type of popup
- After you are done interacting with the popup and would like to interact with the main window, you can use a type of main
- type:
- Details:
- This does not automatically close the popup window, just changes what page you are interacting with
- Even if you close the popup window, you still need to always manually change back to the main window
- Description: Can be used to switch between the main browser window and a pop-up window (different from an alert that is part of the main page)
- action_chain
- Action Chains value details
Additional Information Documentation
- Brian's Test Protocols (*Any bold indicates that it still needs automated)
- These protocols should use the protocol creation test for their setting broadly
- Protocol No: 234657
- Title: BRIANS PERSONAL TEST PROTOCOL DO NOT USE
- Staff:
- Protocol Creator: TesterBTD, Selenium
- Needed for tests:
- Almost all of them
- Protocol No: 234654
- Title: Another Test Protocol - BRIANs
- Staff:
- Data Coordinator: Davidson, Brian
- Primary Study Coordinator: Boysen, Erin
- Principal Investigator: Boysen, Erin
- Protocol Creator: TesterBTD, Selenium
- Study Coordinator: Buehler, Marc
- Status: Get the status to Open to accrual
- Institution: UW - Madison
- Treatment Arms:
- Step Code: '26'
- Arm Code: 'TestingArm'
- Arm Description: 'SeleniumTesting'
- Subjects:
- 1 subject enrolled on the protocol, but not on a treatment arm
- Documents:
- 1 document named TestDocumentUpload.docx with a description of 'Main Study Consent' under the initial IRB Review that is released
- 1 document named Test_Document_Upload.docx with a description of 'Main Protocol Document' under the documents tab
- Calendar/Financials/Sponsor
- Protocol needs one sponsor
- Protocol needs a calendar with one procedure on a day on it
- Protocol financial console needs to have that one procedure select the sponsor as it's sponsor
- Protocol calendar needs to be released
- Coding Scheme:
- CTCAE v5.0
- Includes Specimen Banking:
- Checked
- Needed for tests:
- GEN-CP-040
- GEN-CP-050
- GEN-CP-051
- GEN-CP-052
- GEN-AD-001
- GEN-AD-1.2
- Testing Information
- Sponsor: A_Testing_Sponsor
- Fun: 246
- Acct: 135
- PI: Boysen, Erin
- Department: CALS - Bacteriology
- Sponsor: A_Testing_Sponsor
- Tests requiring local files configured with path
- GEN-CP-038
- GEN-CP-039
- GEN-AS-011
- GEN-AD-2.7
- Special Scripts
- BSM-STOR-001
- Script must be updated after each run (increment counter by 1 where indicated)
- BSM-STOR-002
- Script must be updated after each run (increment counter by 1 where indicated)
- BSM-STOR-003
- Script must be updated after each run (increment counter by 1 where indicated)
- BSM-STOR-001
- Deprecated Tests:
- GEN-CP-049 (This feature has been changed and this test no longer applies)
- GEN-CP-053 (The blue hyperlink no longer appears to change version. And if there is anyone with toxicity details in an SAE, then the update cannot occur.)
Document History
Reviewed Date | Change Reason | Approver |
---|---|---|
11/16/2023 | New | Brian Davidson |
Related Documents
- Link to SOPs
- Link to Controlled Documents