New projct BrowserDriver infered to help with webscraping

This commit is contained in:
2022-02-01 21:15:31 +01:00
parent 5e42d91c1e
commit 5f0c4ef990
17 changed files with 472 additions and 649 deletions

View File

@ -0,0 +1,35 @@
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
namespace BrowserHelper.Extensions
{
public static class WebElementExtension
{
public static void SelectDropDownByText(this IWebElement element, string text)
{
var select = new SelectElement(element);
select.SelectByText(text);
}
public static void SelectDropDownByValue(this IWebElement element, string value)
{
var select = new SelectElement(element);
select.SelectByValue(value);
}
public static void SelectDropDownByIndex(this IWebElement element, int index)
{
var select = new SelectElement(element);
select.SelectByIndex(index);
}
public static void ClearAndEnterText(this IWebElement element, string value)
{
element.Clear();
element.SendKeys(value);
}
public static string GetSelectedDropDownValue(this IWebElement element)
{
return new SelectElement(element).SelectedOption.Text;
}
}
}