perf: reduce fixed sleeps in MassHealth click_plus_button
Cuts unconditional delay when adding a service line from ~7s to ~3s as a first pass at speeding up MassHealth claim submission.
This commit is contained in:
@@ -694,7 +694,7 @@ class AutomationMassHealthClaimsLogin:
|
|||||||
print("DEBUG: Clicking plus button to add new service line")
|
print("DEBUG: Clicking plus button to add new service line")
|
||||||
|
|
||||||
# Step 1: Wait a moment to ensure the previous service line is fully processed
|
# Step 1: Wait a moment to ensure the previous service line is fully processed
|
||||||
time.sleep(3)
|
time.sleep(1)
|
||||||
|
|
||||||
# Step 2: Try multiple approaches to find the plus button
|
# Step 2: Try multiple approaches to find the plus button
|
||||||
plus_button = None
|
plus_button = None
|
||||||
@@ -768,11 +768,11 @@ class AutomationMassHealthClaimsLogin:
|
|||||||
print(f"DEBUG: JavaScript approach failed: {e}")
|
print(f"DEBUG: JavaScript approach failed: {e}")
|
||||||
raise Exception("Could not find plus button with any method")
|
raise Exception("Could not find plus button with any method")
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(0.5)
|
||||||
|
|
||||||
# Step 3: Scroll into view
|
# Step 3: Scroll into view
|
||||||
self.driver.execute_script("arguments[0].scrollIntoView(true);", plus_button)
|
self.driver.execute_script("arguments[0].scrollIntoView(true);", plus_button)
|
||||||
time.sleep(1)
|
time.sleep(0.5)
|
||||||
|
|
||||||
# Step 4: Check if button is enabled
|
# Step 4: Check if button is enabled
|
||||||
is_disabled = plus_button.get_attribute("disabled")
|
is_disabled = plus_button.get_attribute("disabled")
|
||||||
@@ -804,8 +804,8 @@ class AutomationMassHealthClaimsLogin:
|
|||||||
actions = ActionChains(self.driver)
|
actions = ActionChains(self.driver)
|
||||||
actions.move_to_element(plus_button).click().perform()
|
actions.move_to_element(plus_button).click().perform()
|
||||||
|
|
||||||
time.sleep(2) # Wait for new row to be created
|
time.sleep(1) # Wait for new row to be created
|
||||||
|
|
||||||
print("DEBUG: Successfully clicked plus button")
|
print("DEBUG: Successfully clicked plus button")
|
||||||
return "Success"
|
return "Success"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user