{"id":28389029,"url":"https://github.com/iodesystems/seleniumjquery","last_synced_at":"2025-06-27T16:31:38.139Z","repository":{"id":1994664,"uuid":"2927529","full_name":"IodeSystems/SeleniumJQuery","owner":"IodeSystems","description":"Reactive Selenium jQuery dom integration","archived":false,"fork":false,"pushed_at":"2025-06-02T18:29:08.000Z","size":562,"stargazers_count":12,"open_issues_count":5,"forks_count":11,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-06-03T08:08:17.260Z","etag":null,"topics":["java","jquery","kotlin","selenium"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IodeSystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-12-06T19:57:32.000Z","updated_at":"2025-06-02T18:25:40.000Z","dependencies_parsed_at":"2023-10-16T11:37:40.531Z","dependency_job_id":"7525a201-68cf-480c-9172-d73cfb92e30c","html_url":"https://github.com/IodeSystems/SeleniumJQuery","commit_stats":null,"previous_names":["iodesystems/seleniumjquery","nthalk/seleniumjquery"],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/IodeSystems/SeleniumJQuery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IodeSystems%2FSeleniumJQuery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IodeSystems%2FSeleniumJQuery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IodeSystems%2FSeleniumJQuery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IodeSystems%2FSeleniumJQuery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IodeSystems","download_url":"https://codeload.github.com/IodeSystems/SeleniumJQuery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IodeSystems%2FSeleniumJQuery/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262293174,"owners_count":23288675,"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":["java","jquery","kotlin","selenium"],"created_at":"2025-05-31T00:12:02.887Z","updated_at":"2025-06-27T16:31:38.131Z","avatar_url":"https://github.com/IodeSystems.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"Selenium jQuery\n====================================\nWorking with selenium's selector api is a huge pain in the ass.\n\nWhat technology likes to fix bad web-centric apis for the most developer centric ergonomics? JQUERY!\n\nThe technology from the 90s is still saving us from bad design today!\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.iodesystems.selenium-jquery\u003c/groupId\u003e\n  \u003cartifactId\u003eselenium-jquery\u003c/artifactId\u003e\n  \u003cversion\u003e2.1.3\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nOverview\n------------------------------------\n`SeleniumJQuery` rides on `Selenium`'s `RemoteWebDriver` api and automagically installs `jQuery` in \nwebsites to make automation and testing a breeze.\n\nCombined with `kotlin`'s DSL utilities, `PageObject` design goes to it's well deserved grave.\n\nExample\n------------------------------------\n\nCheck out `jQueryTest.kt` for an example of how to bootstrap the `jQuery` object\nusing `webdrivermanager`:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.bonigarcia\u003c/groupId\u003e\n    \u003cartifactId\u003ewebdrivermanager\u003c/artifactId\u003e\n    \u003cversion\u003e5.3.2\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nCreating the driver and `jQuery` instance:\n```kotlin\n// Use WebDriverManager to ensure full selenium protocol compatibility for performance\nWebDriverManager.chromedriver().setup()\n// Silence as much noise as possible\nval chromeDriverService: ChromeDriverService = ChromeDriverService.Builder()\n    .withSilent(true)\n    .build()\nchromeDriverService.sendOutputTo(NullOutputStream.NULL_OUTPUT_STREAM)\n\nvar options = ChromeOptions()\n// Disable attempts to save things to the profile\noptions.setExperimentalOption(\n    \"prefs\", mapOf(\n        \"autofill.profile_enabled\" to false\n    )\n)\n// Don't show popup notifications\noptions.addArguments(\"--disable-notifications\")\n// Ignore prompts\noptions.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.DISMISS)\n// Don't bother waiting for the entire dom to load, if you can do your thang already\noptions.setPageLoadStrategy(PageLoadStrategy.EAGER)\nif (headless) {\n    options = options\n        .addArguments(\"--headless\")\n        .addArguments(\"window-size=1920,1080\")\n}\nval driver = ChromeDriver(chromeDriverService, options)\n// Set some sane amount of timeout so tests don't hang on issues\ndriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5))\n```\n\nUsing the `jQuery` object:\n```kotlin\njq.page(\"http://google.com\") {\n    find(\"input[name='q']\").sendKeys(\"hello world\", 30)\n    find(\"input[value='Google Search']\").first().click()\n    find(\"#result-stats\").visible()\n}\n```\n\nNested objects, parent and child traversals:\n```kotlin\njq.page(\"http://some-page.com\") {\n    frame(\"#frame-id\") {\n        find(\".hidden-in-frame\").parent(\".most-recent-parent-containing\") {\n            find(\".child-of-that-parent\")\n        }\n    }\n    find(\".a\"){\n        // Hierarchy can be nested as far as you like\n        find(\".b\"){\n            // Reroot breaks out of hierarchy            \n            reroot(\"body\").exists()\n        }\n    }\n}\n```\n\nMore aggressive testing for difficult controls:\n```kotlin\n// Not direct clicking due to bubbling? FORCE IT!\nfind(\".weird-control\").clickForce()\n// Controlled text input masking things all weird? Put a delay in it!\nfind(\".text-settling-input\").clear().sendKeys(\"important\", delayMilis = 100)\n```\n\nExtension\n------------------------------------\nI'll admit, `SeleniumJQuery` doesn't have it all, pull requests are welcome, however, it's super easy to\nextend the `IEl` object with `kotlin`'s extension functions:\n\n```kotlin\n// Some examples for the Mui framework and general time savers:\nfun jQuery.IEl.inputLabeled(label: String) =\n  find(\".MuiInputBase-formControl\")\n      .contains(label)\n      .find(\":input:first\")\nfun jQuery.IEl.buttonLabeled(label: String) = \n    find(\"button\")\n    .contains(label)\n    .enabled()\nfun jQuery.IEl.linkWithText(text: String) = \n    find(\"a\")\n        .contains(text)\nfun jQuery.IEl.buttonWithIcon(icon: String) = \n    find(\"svg[data-testid='$icon']\")\n        .parent(\"button\")\n```\n\nCustom domain objects are also a breeze:\n```kotlin\n// Page Object DSL\ndata class Dialog(val el:IEl) : IEl by el {\n    fun password(password:String) = inputLabeled(\"Password\").first().sendKeys(password)\n    fun submit() = find(\"button[type=submit]\").click()\n}\n// Bootstrap extension:\nfun \u003cT\u003e jQuery.IEl.dialog(\n    label: String,\n    fn: Dialog.()-\u003eT\n) {\n    val el = find(\".dialog-container\").contains(label)\n    return fn(Dialog(el))\n}\n// Usage:\n...\njq.page{\n    dialog(\"Enter Password\"){\n        password(\"super secure!\") // DSL\n        submit() // DSL\n        gone() // EL method: Wait until dialog disappears\n    }\n}\n...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiodesystems%2Fseleniumjquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiodesystems%2Fseleniumjquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiodesystems%2Fseleniumjquery/lists"}