From ae3e1ee04df4555d9bc088f19dce08b653ca6f3d Mon Sep 17 00:00:00 2001 From: arul Date: Mon, 11 Aug 2025 22:04:27 +0530 Subject: [PATCH] Fixed the Input. React app relies on Input state not the DOM --- .../com/ghost/temple/ReusableFunctions.java | 73 +++++++++++++++++- storage.json | 2 +- .../com/ghost/temple/ReusableFunctions.class | Bin 11317 -> 12903 bytes target/cucumber-report.html | 2 +- .../TEST-com.ghost.temple.AppTest.xml | 6 +- .../TEST-com.ghost.temple.TestRunner.xml | 6 +- .../com.ghost.temple.AppTest.txt | 2 +- .../com.ghost.temple.TestRunner.txt | 2 +- 8 files changed, 80 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/ghost/temple/ReusableFunctions.java b/src/main/java/com/ghost/temple/ReusableFunctions.java index b7c169d..15dfd3f 100644 --- a/src/main/java/com/ghost/temple/ReusableFunctions.java +++ b/src/main/java/com/ghost/temple/ReusableFunctions.java @@ -99,13 +99,13 @@ public static void fillQuestInputsAndRewards( if (xpath.trim().endsWith("::input")) { // For input fields System.out.println("⌨️ Setting input (XPath: " + xpath + ") to value: " + value); - String status = clearAndSetInputByXPathJS(driver, xpath, value); + String status = setReactElementValueByXpathJS(driver, xpath, value); System.out.println("Status: " + status); } else if (xpath.trim().endsWith("::select")) { // For dropdown selects System.out.println("🎯 Selecting dropdown (XPath: " + xpath + ") with option: " + value); - String status = selectDropdownOptionByXpathJS(driver, xpath, value); + String status = setReactElementValueByXpathJS(driver, xpath, value); System.out.println("Status: " + status); } else { @@ -274,6 +274,73 @@ public static void sleepInSeconds(long seconds) { return (String) jsExecutor.executeScript(jsCode, inputXpath, value); } + /** + * Set value in a React-controlled or