{"id":18260475,"url":"https://github.com/sudharsan-selvaraj/selenium-auto-wait","last_synced_at":"2025-04-04T19:33:15.094Z","repository":{"id":57734937,"uuid":"375251949","full_name":"sudharsan-selvaraj/selenium-auto-wait","owner":"sudharsan-selvaraj","description":"Utility to automatically manage all web element waits and enables to write wait-free selenium tests.","archived":false,"fork":false,"pushed_at":"2021-06-10T07:36:57.000Z","size":75,"stargazers_count":39,"open_issues_count":2,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T20:51:36.414Z","etag":null,"topics":["automation","selenium","selenium-java","testing-tools","ui-automation","wait-free","webdriver"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sudharsan-selvaraj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-09T06:37:12.000Z","updated_at":"2024-08-03T08:23:14.000Z","dependencies_parsed_at":"2022-08-24T11:20:36.131Z","dependency_job_id":null,"html_url":"https://github.com/sudharsan-selvaraj/selenium-auto-wait","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudharsan-selvaraj%2Fselenium-auto-wait","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudharsan-selvaraj%2Fselenium-auto-wait/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudharsan-selvaraj%2Fselenium-auto-wait/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudharsan-selvaraj%2Fselenium-auto-wait/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sudharsan-selvaraj","download_url":"https://codeload.github.com/sudharsan-selvaraj/selenium-auto-wait/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247238442,"owners_count":20906443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","selenium","selenium-java","testing-tools","ui-automation","wait-free","webdriver"],"created_at":"2024-11-05T10:45:36.773Z","updated_at":"2025-04-04T19:33:14.626Z","avatar_url":"https://github.com/sudharsan-selvaraj.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# selenium-auto-wait\nselenium-auto-wait automatically manages all weblement waits and makes you to write wait free selenium tests.\n\n## Features\n1. Waits till element found when using findElement method. Unlike Webdriver's implicit wait method, you can control this behaviour using annotations.\n2. Waits for the element to become intractable before performing any action on it.\n3. If you using pageobject model and wants to ignore auto wait for certain methods, you can use `@IgnoreWait` annotation.\n4. You can use `@WaitProperties` annotation to control the behaviour of auto wait for a specific method in the page object method.\n\n## Installation\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.sudharsan-selvaraj\u003c/groupId\u003e\n    \u003cartifactId\u003eselenium-auto-wait\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.2\u003c/version\u003e\n\u003c/dependency\u003e \n```\n\n### Gradle\n\n```groovy\nimplementation group: 'io.github.sudharsan-selvaraj', name: 'selenium-auto-wait', version: '1.0.2'\n```\n\nAlso while downloading selenium, make sure to exclude `net.bytebuddy:byte-buddy` library by using\n\n### Maven\n```xml\n\u003cdependency\u003e\n   \u003cgroupId\u003eorg.seleniumhq.selenium\u003c/groupId\u003e\n   \u003cartifactId\u003eselenium-java\u003c/artifactId\u003e\n   \u003cversion\u003e3.141.59\u003c/version\u003e\n   \u003cexclusions\u003e\n      \u003cexclusion\u003e\n         \u003cgroupId\u003enet.bytebuddy\u003c/groupId\u003e\n         \u003cartifactId\u003ebyte-buddy\u003c/artifactId\u003e\n      \u003c/exclusion\u003e\n   \u003c/exclusions\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n```groovy\nimplementation (group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59') {\n   exclude group: 'net.bytebuddy', module: 'byte-buddy'\n }\n```\n\n## Quickstart\n\nInitialize the wait plugin using\n```java\nSeleniumWaitOptions options = SeleniumWaitOptions.builder()\n                .parseAnnotations(true)\n                .defaultWaitTime(Duration.ofSeconds(30))\n                .build();\nSeleniumWaitPlugin\u003cChromeDriver\u003e seleniumWaitPlugin = new SeleniumWaitPlugin\u003cChromeDriver\u003e(new ChromeDriver(), options);\nWebDriver driver =  seleniumWaitPlugin.getDriver();\n```\nThat's it. Now the driver object can be used in the test.\n\n## Available options\n\n* `defaultWaitTime` (Duration) - Used as a timeout while waiting for element.\n* `excludedMethods` (List\u003cString\u003e) - List of method names that will be ignored in auto wait.\n* `parseAnnotations` (Boolean) - If true, the plugin will look for `@IgnoreWait` or `@WaitProperties` annotation and manages wait based on it. Default value is `false`\n* `packageToBeParsed` (String) - if `parseAnnotations` is true, the plugin will parse all the methods from the stacktrace looking for annotations. If you want to search the annotations only on a specific package then you can mention it here.\n\n## Annotation Example:\n\n```java\npublic class WaitTest {\n    \n    public WebDriver getDriver() {\n        SeleniumWaitOptions options = SeleniumWaitOptions.builder()\n                .parseAnnotations(true)\n                .defaultWaitTime(Duration.ofSeconds(30))\n                .build();\n      \n        SeleniumWaitPlugin seleniumWaitPlugin = new SeleniumWaitPlugin(new ChromeDriver(), options);\n        return seleniumWaitPlugin.getDriver();\n    }\n    \n    @Test\n    public void test() {\n        WebDriver driver = getDriver();\n        searchAmazon(driver);\n        searchAmazonWithoutWait(driver);\n        searchAmazonWithCustomWait(driver);\n    }\n\n    public void searchAmazon(WebDriver driver) {\n        driver.get(\"https://www.amazon.in\");\n        driver.findElement(By.id(\"twotabsearchtextbox\")).sendKeys(\"oneplus 7\");\n        driver.findElement(By.id(\"twotabsearchtextbox\")).sendKeys(Keys.ENTER);\n        driver.findElement(By.partialLinkText(\"OnePlus 7 Pro\")).click();\n        driver.switchTo().window(driver.getWindowHandles().toArray(new String[]{})[1]);\n        driver.findElement(By.id(\"add-to-cart-button\")).click();\n        driver.findElement(By.id(\"attach-view-cart-button-form\")).click();\n    }\n    \n    @IgnoreWait // will not automatically wait for any element interaction\n    public void searchAmazonWithoutWait(WebDriver driver) {\n        driver.get(\"https://www.amazon.in\");\n        new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id(\"twotabsearchtextbox\")));\n        driver.findElement(By.id(\"twotabsearchtextbox\")).sendKeys(\"oneplus 7\", Keys.ENTER);\n        new WebDriverWait(driver, 10)\n                .until(ExpectedConditions.presenceOfElementLocated(By.partialLinkText(\"OnePlus 7 Pro\")));\n        driver.findElement(By.partialLinkText(\"OnePlus 7 Pro\")).click();\n        driver.switchTo().window(driver.getWindowHandles().toArray(new String[]{})[1]);\n        new WebDriverWait(driver, 10)\n                .until(ExpectedConditions.presenceOfElementLocated(By.id(\"add-to-cart-button\")));\n        driver.findElement(By.id(\"add-to-cart-button\")).click();\n        new WebDriverWait(driver, 10)\n                .until(ExpectedConditions.elementToBeClickable(By.id(\"attach-view-cart-button-form\")));\n        driver.findElement(By.id(\"attach-view-cart-button-form\")).click();\n    }\n\n    @WaitProperties(\n            timeout = 10, //custom wait time in seconds\n            exclude = {\"sendKeys\"} // will not automatically wait for sendKeys method\n    )\n    public void searchAmazonWithCustomWait(WebDriver driver) {\n        driver.get(\"https://www.amazon.in\");\n        driver.findElement(By.id(\"twotabsearchtextbox\")).sendKeys(\"oneplus 7\");\n        driver.findElement(By.id(\"twotabsearchtextbox\")).sendKeys(Keys.ENTER);\n        driver.findElement(By.partialLinkText(\"OnePlus 7 Pro\")).click();\n        driver.switchTo().window(driver.getWindowHandles().toArray(new String[]{})[1]);\n        driver.findElement(By.id(\"add-to-cart-button\")).click();\n        driver.findElement(By.id(\"attach-view-cart-button-form\")).click();\n    }\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudharsan-selvaraj%2Fselenium-auto-wait","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsudharsan-selvaraj%2Fselenium-auto-wait","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudharsan-selvaraj%2Fselenium-auto-wait/lists"}