Skip to content

Commit d50f57a

Browse files
Adding new util to dynamically get locators
1 parent 71d791a commit d50f57a

File tree

4 files changed

+284
-469
lines changed

4 files changed

+284
-469
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Utility Guide: Dynamic Locator Retriever
2+
3+
The Dynamic Locator Retriever utility allows for selecting different locators dynamically.<br>
4+
For example, on the investigation dataset, if we want to select the input locator for the `Start of intubation time` field, we can do this by providing the util with the name of the field
5+
6+
DynamicLocatorRetriever(page).populate_input_locator_for_field(
7+
"Start of intubation time", "09:00"
8+
)
9+
10+
## Table of Contents
11+
12+
- [Utility Guide: Dynamic Locator Retriever](#utility-guide-dynamic-locator-retriever)
13+
- [Table of Contents](#table-of-contents)
14+
- [Using the Dynamic Locator Retriever class](#using-the-dynamic-locator-retriever-class)
15+
- [Required Args](#required-args)
16+
- [How to use this method](#how-to-use-this-method)
17+
18+
## Using the Dynamic Locator Retriever class
19+
20+
You can initialise the Dynamic Locator Retriever class by using the following code in your test file:
21+
22+
from utils.dynamic_locator_retriever import DynamicLocatorRetriever
23+
24+
This will allow you to use the following methods:
25+
26+
1. populate_input_locator_for_field
27+
1. This will allow you to populate the field next to the given text where the type is `input`
28+
2. populate_select_locator_for_field
29+
1. This will allow you to populate the field next to the given text where the type is `select`
30+
3. populate_input_locator_for_field_inside_div
31+
1. This will allow you to populate the field next to the given text where the type is `input`, and inside of a specified container
32+
4. populate_select_locator_for_field_inside_div
33+
1. This will allow you to populate the field next to the given text where the type is `select`, and inside of a specified container
34+
35+
### Required Args
36+
37+
populate_input_locator_for_field / populate_select_locator_for_field
38+
39+
- text:
40+
- Type: `str`
41+
- The text of the element you want to interact with.
42+
- value/option:
43+
- Type: `str`
44+
- The value or option you want to input / select (depending on what method is called)
45+
46+
populate_input_locator_for_field_inside_div / populate_select_locator_for_field_inside_div
47+
48+
- text:
49+
- Type: `str`
50+
- The text of the element you want to interact with.
51+
- div:
52+
- Type: `str`
53+
- The ID of the container that the element belongs in.
54+
- value/option:
55+
- Type: `str`
56+
- The value or option you want to input / select (depending on what method is called)
57+
58+
### How to use this method
59+
60+
To use this method simply import the SubjectDemographicUtil class and call one of the methods, providing the necessary arguments:
61+
62+
# populate_input_locator_for_field
63+
DynamicLocatorRetriever(page).populate_input_locator_for_field(
64+
"End time of procedure", "09:30"
65+
)
66+
67+
# populate_select_locator_for_field
68+
DynamicLocatorRetriever(page).populate_select_locator_for_field(
69+
"Insufflation", InsufflationOptions.AIR
70+
)
71+
72+
# populate_input_locator_for_field_inside_div
73+
DynamicLocatorRetriever(page).populate_input_locator_for_field_inside_div(
74+
"Estimate of whole polyp size", "divPolypNumber1Section", "15"
75+
)
76+
77+
# populate_select_locator_for_field_inside_div
78+
DynamicLocatorRetriever(page).populate_select_locator_for_field_inside_div(
79+
"Classification", "divPolypNumber1Section", PolypClassificationOptions.LS
80+
)

0 commit comments

Comments
 (0)