From c4cf6964a3a955939e2c35a4b786a9c239bc1b12 Mon Sep 17 00:00:00 2001 From: Vishnu Date: Wed, 4 Jun 2025 19:07:13 +0530 Subject: [PATCH] selenium working well --- .../src/components/claims/claim-form.tsx | 2 +- apps/SeleniumService/agent.py | 2 -- apps/SeleniumService/selenium_worker.py | 23 +++++++++---------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/apps/Frontend/src/components/claims/claim-form.tsx b/apps/Frontend/src/components/claims/claim-form.tsx index 8662fb4..f0c590b 100644 --- a/apps/Frontend/src/components/claims/claim-form.tsx +++ b/apps/Frontend/src/components/claims/claim-form.tsx @@ -599,7 +599,7 @@ export function ClaimForm({ } /> updateServiceLine(i, "toothSurface", e.target.value) diff --git a/apps/SeleniumService/agent.py b/apps/SeleniumService/agent.py index 5846b87..44767bf 100644 --- a/apps/SeleniumService/agent.py +++ b/apps/SeleniumService/agent.py @@ -15,8 +15,6 @@ app.add_middleware( @app.post("/run") async def run_bot(request: Request): data = await request.json() - print(data) - input("waiting") try: bot = AutomationMassDHP(data) result = bot.main_workflow("https://providers.massdhp.com/providers_login.asp") diff --git a/apps/SeleniumService/selenium_worker.py b/apps/SeleniumService/selenium_worker.py index 7eb4a2b..bfd906f 100644 --- a/apps/SeleniumService/selenium_worker.py +++ b/apps/SeleniumService/selenium_worker.py @@ -201,13 +201,11 @@ class AutomationMassDHP: # 2 - Upload PDFs: try: - pdfs_abs = [proc for proc in self.pdfs] - with tempfile.TemporaryDirectory() as tmp_dir: for pdf_obj in pdfs_abs: - base64_data = pdf_obj["buffer"] + base64_data = pdf_obj["bufferBase64"] file_name = pdf_obj.get("originalname", "tempfile.pdf") # Full path with original filename inside temp dir @@ -232,7 +230,7 @@ class AutomationMassDHP: # 3 - Indicate Missing Teeth Part try: # Handle the missing teeth section based on the status - missing_status = self.missingTeethStatus + missing_status = self.missingTeethStatus.strip() if self.missingTeethStatus else "No_missing" if missing_status == "No_missing": missing_teeth_no = wait.until(EC.presence_of_element_located((By.XPATH, "//input[@type='checkbox' and @name='PAU_Step3_Checkbox1']"))) @@ -265,15 +263,16 @@ class AutomationMassDHP: # 4 - Update Remarks try: - textarea = wait.until(EC.presence_of_element_located((By.XPATH, "//textarea[@name='Remarks']"))) - textarea.clear() - textarea.send_keys(self.remarks) + if self.remarks.strip(): + textarea = wait.until(EC.presence_of_element_located((By.XPATH, "//textarea[@name='Remarks']"))) + textarea.clear() + textarea.send_keys(self.remarks) - # Wait for update button and click it - update_button = wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@type='submit' and @value='Update Remarks']"))) - update_button.click() - - time.sleep(3) + # Wait for update button and click it + update_button = wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@type='submit' and @value='Update Remarks']"))) + update_button.click() + + time.sleep(3) except Exception as e: print(f"Error while filling remarks: {e}")