@@ -81,6 +81,11 @@ def __init__(self, page: Page):
8181 self .visible_ui_results_string = 'select[id^="UI_RESULTS_"]:visible'
8282 self .sections = self .page .locator (".DatasetSection" )
8383
84+ # Repeat strings:
85+ self .bowel_preparation_administered_string = "Bowel Preparation Administered"
86+ self .antibiotics_administered_string = "Antibiotics Administered"
87+ self .other_drugs_administered_string = "Other Drugs Administered"
88+
8489 def select_site_lookup_option (self , option : str ) -> None :
8590 """
8691 This method is designed to select a site from the site lookup options.
@@ -787,11 +792,11 @@ def get_drug_type_locator(self, drug_type: str, drug_number: int) -> Locator:
787792 drug_type (str): The drug type to check
788793 drug_number (int): The number of the drug to check
789794 """
790- if drug_type == "Bowel Preparation Administered" :
795+ if drug_type == self . bowel_preparation_administered_string :
791796 locator_prefix = "#UI_BOWEL_PREP_DRUG"
792- elif drug_type == "Antibiotics Administered" :
797+ elif drug_type == self . antibiotics_administered_string :
793798 locator_prefix = "#UI_ANTIBIOTIC"
794- elif drug_type == "Other Drugs Administered" :
799+ elif drug_type == self . other_drugs_administered_string :
795800 locator_prefix = "#UI_DRUG"
796801 return self .page .locator (f"{ locator_prefix } { drug_number } " )
797802
@@ -802,11 +807,11 @@ def get_drug_dose_locator(self, drug_type: str, drug_number: int) -> Locator:
802807 drug_type (str): The drug type to check
803808 drug_number (int): The number of the drug to check
804809 """
805- if drug_type . lower () == "bowel preparation administered" :
810+ if drug_type == self . bowel_preparation_administered_string :
806811 locator_prefix = "#UI_BOWEL_PREP_DRUG_DOSE"
807- elif drug_type . lower () == "antibiotics administered" :
812+ elif drug_type == self . antibiotics_administered_string :
808813 locator_prefix = "#UI_ANTIBIOTIC_DOSE"
809- elif drug_type . lower () == "other drugs administered" :
814+ elif drug_type == self . other_drugs_administered_string :
810815 locator_prefix = "#UI_DOSE"
811816 return self .page .locator (f"{ locator_prefix } { drug_number } " )
812817
@@ -943,11 +948,11 @@ def get_drug_dose_unit_locator(self, drug_type: str, drug_number: int) -> Locato
943948 drug_type (str): The drug type to check
944949 drug_number (int): The number of the drug to check
945950 """
946- if drug_type . lower () == "bowel preparation administered" :
951+ if drug_type == self . bowel_preparation_administered_string :
947952 locator_prefix = "#spanBowelPrepDrugDosageUnit"
948- elif drug_type . lower () == "antibiotics administered" :
953+ elif drug_type == self . antibiotics_administered_string :
949954 locator_prefix = "#spanAntibioticDosageUnit"
950- elif drug_type . lower () == "other drugs administered" :
955+ elif drug_type == self . other_drugs_administered_string :
951956 locator_prefix = "#spanDosageUnit"
952957 return self .page .locator (f"{ locator_prefix } { drug_number } " )
953958
@@ -1006,9 +1011,9 @@ def get_drug_dosage_text_locator(self, drug_type: str, drug_number: int) -> Loca
10061011 drug_type (str): The drug type to check
10071012 drug_number (int): The number of the drug to check
10081013 """
1009- if drug_type . lower () == "bowel preparation administered" :
1014+ if drug_type == self . bowel_preparation_administered_string :
10101015 locator_prefix = "#HILITE_spanBowelPrepDrugDosageUnit"
1011- elif drug_type . lower () == "antibiotics administered" :
1016+ elif drug_type == self . antibiotics_administered_string :
10121017 locator_prefix = "#HILITE_spanAntibioticDosageUnit"
10131018 return self .page .locator (f"{ locator_prefix } { drug_number } " )
10141019
0 commit comments