{"id":18397234,"url":"https://github.com/intellitect/testtools.selenate","last_synced_at":"2025-04-28T13:45:02.326Z","repository":{"id":103149055,"uuid":"555013235","full_name":"IntelliTect/TestTools.Selenate","owner":"IntelliTect","description":"A testing library to help with UI testing automation","archived":false,"fork":false,"pushed_at":"2025-02-17T05:26:48.000Z","size":166,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-20T06:02:52.711Z","etag":null,"topics":["nuget","nuget-package","selenium"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/IntelliTect.TestTools.Selenate","language":"C#","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/IntelliTect.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-20T19:52:43.000Z","updated_at":"2025-02-17T05:26:50.000Z","dependencies_parsed_at":"2023-10-02T06:36:29.930Z","dependency_job_id":"e77f9853-36cf-400a-a962-1a6ff4884ce1","html_url":"https://github.com/IntelliTect/TestTools.Selenate","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/IntelliTect%2FTestTools.Selenate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelliTect%2FTestTools.Selenate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelliTect%2FTestTools.Selenate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelliTect%2FTestTools.Selenate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IntelliTect","download_url":"https://codeload.github.com/IntelliTect/TestTools.Selenate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251321651,"owners_count":21570770,"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":["nuget","nuget-package","selenium"],"created_at":"2024-11-06T02:16:22.970Z","updated_at":"2025-04-28T13:45:02.295Z","avatar_url":"https://github.com/IntelliTect.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Selenate\n==========\nProvides wrapper functions to leverage commonly used WebDriverWaits. Note that this does not provide exhaustive functionality, and customer WebDriverWaits will still be needed for complex or unique scenarios.\n\nSimple Usage\n-----\nTo instantiate a class that manages simple WebDriver interactions:\n```C#\n// WebDriverFactory is not required. You can pass in your own IWebDriver to DriverHandler instead.\nIWebDriver driver = new WebDriverFactory(BrowserType.Chrome).GetDriver();\nDriverHandler handler = new(driver);\nhandler.NavigateToPage(\"http://www.some-page.com/\");\n```\n\nTo instantiate a class that manages simple interactions with a single IWebElement (note: this uses a Page Object Model approach):\n```C#\npublic class SomePageUnderTest\n{\n    public SomePageUnderTest(IWebDriver driver)\n    {\n        _Driver = driver;\n    }\n\n    // Note that this will not save any settings (e.g. StartButton.SetTimeoutSeconds(30)) made after object instantiation.\n    // Use an explicit getter with a private backing field for that.\n    public ElementHandler SomeButton =\u003e new (_Driver, By.CssSelector(\"div[id='someId']\"));\n\n    private IWebDriver _Driver;\n}\n\npublic class SomeTest\n{\n    public SomeTest()\n    {\n        IWebDriver driver = new WebDriverFactory(BrowserType.Chrome).GetDriver();\n        _Handler = new(driver);\n    }\n\n    private DriverHandler _Handler;\n\n    // Also works with other runners like MSTest and NUnit\n    [Fact]\n    public void Testing()\n    {\n        // Arrange\n        SomePageUnderTest put = new(_Handler.WrappedDriver);\n        _Handler.NavigateToPage(\"http://www.some-page.com/\");\n\n        // Act\n        // Below automatically waits for the element to exist and be clickable before executing.\n        put.SomeButton.Click();\n\n        // Assert (pretend the button disappears after clicking it.)\n        // Default timeout is 15s. Override for this call.\n        Assert.True(put.SomeButton.SetTimeoutSeconds(5).WaitForNotDisplayed(),\n            \"The button did not disappear within 5s after clicking it.\");\n    }\n}\n\n```\n\nComplex Use Cases\n-----\nUsing the same structure as above, we can create complex use cases\n\n```C#\npublic void SomeTest\n{\n    // Same setup as above.\n\n    // Also works with other runners like MSTest and NUnit\n    [Fact]\n    public void SomeOtherTest()\n    {\n        // Arrange\n        // Note: to reduce code duplication, this can be abstracted out into the Page Object for small projects,\n        // Or into an explicit class of grouped actions for large projects.\n        SomePageUnderTest put = new(_Handler.WrappedDriver);\n        _Handler.NavigateToPage(\"http://www.some-page.com/\");\n\n        // Act and Assert\n        // Sometimes the site is slow to load, and the initial click doesn't do anything.\n        // For whatever reason, dev team won't fix.\n\n        WebDriverWait wait = new(_Handler.WrappedDriver, TimeSpan.FromSeconds(30));\n        wait.IgnoreExceptionTypes(\n            typeof(NoSuchElementException),\n            typeof(InvalidElementStateException),\n            typeof(ElementNotVisibleException),\n            typeof(StaleElementReferenceException),\n            typeof(ElementClickInterceptedException));\n        \n        // If the button continues to be displayed once the 30s timeout is reached,\n        // This will throw a WebDriverTimeout exception.\n        // Note: if you want a friendly assert message,\n        //   you can wrap just this block of code in a try/catch(WebDriverException) and selectively assign a variable true or false / assert on the result.\n        // Best practice in that scenario is to abstract out to a harness page object or group action object as soon as a second instance of this pattern is used.\n        wait.Until(x =\u003e x\n        {\n            IWebElement someButton = x.FindElement(put.SomeButton.Locator);\n            someButton.Click();\n            return !someButton.Displayed;\n        })\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintellitect%2Ftesttools.selenate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintellitect%2Ftesttools.selenate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintellitect%2Ftesttools.selenate/lists"}