package com.ghost.temple; import org.openqa.selenium.*; public class ReusableFunctions { public static boolean checkWebElement(WebElement element) { try { return element.isDisplayed() && element.isEnabled(); } catch (Exception e) { return false; } } public static void click(WebElement element) { if (checkWebElement(element)) { element.click(); } } public static void fillInput(WebElement element, String value) { if (checkWebElement(element)) { element.clear(); element.sendKeys(value); } } public static void scrollIntoView(WebDriver driver, WebElement element) { ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element); } // 🌐 NEW: Open a specific URL public static void openUrl(WebDriver driver, String url) { try { driver.get(url); } catch (Exception e) { System.out.println("Error navigating to URL: " + url); e.printStackTrace(); } } }