This package contains various extension methods for the Selenium.Webdriver NuGet package to make interacting with the browser easier and more natural.
Add the NuGet package 'Selenium.Extension.Collection' to your solution and you are ready to go.
There are extensions at different kind of levels available to use.
These extensions give extra functionality to the driver.
This method waits for an element to be visible on your page. You can specify the timeout yourself, which defaults to 2 seconds.
_Driver.WaitForElementToShow(By.Id("waitForElementToShowDelay"), 5);
This method waits for an element to be gone from your page. You can specify the timeout yourself, which defaults to 2 seconds.
_Driver.WaitForElementToDisappear(By.Id("waitForElementToDisappearDelay"), 5);
These extensions give extra functionality to classes that implement ISearchContext.
This method tries to locate the element. If the element is not found, instead of throwing an exception the value NULL is returned.
_Driver.FindElementIfExists(By.Id("elementToFind"));
These extensions give extra functionality to the WebElement object.
This method returns the HTML that is inside the specified element as string.
_Driver.FindElementIfExists(By.Id("elementToFind")).InnerHtml();
This method returns the full HTML of the element, including its own tag.
_Driver.FindElementIfExists(By.Id("elementToFind")).OuterHtml();
This method returns classes of the element, as one string.
_Driver.FindElementIfExists(By.Id("elementToFind")).Class();
This method returns true if the specified class exists on the element, or false when it doesn't.
_Driver.FindElementIfExists(By.Id("elementToFind")).HasClass("class2");