Creating the first project with Selenium https://www.selenium.dev/

Start by create a new project : Consoloa App (.Net Framework)

Add the NuGet packages: Selenium.WebDriver

Edit the “Program.cs” file and add this code :

 1        static void Main(string[] args)
 2        {
 3            IWebDriver driver = new ChromeDriver();
 4            driver.Navigate().GoToUrl("http://www.google.com");
 5            Thread.Sleep(2000);
 6            IWebElement ele = driver.FindElement(By.Name("q"));
 7            ele.SendKeys("Selenium browser automated test");
 8            Thread.Sleep(2000);
 9            IWebElement ele1 = driver.FindElement(By.Name("btnK"));
10            ele1.Click();
11            Thread.Sleep(20000);
12
13        }

and run …

Selenium WebDriver Features:

  • Navitaget to a page (URL)
  • Click button
  • Send text into the fields
  • Get the title of the current oage
  • Maximize/Minimise the browser
  • Take a screenshot

Problems & Fixs

Just End process

References:

XPath online real-time tester, evaluator and generator for XML and HTML (xpather.com)

Actions Class (selenium.dev)

ChromeDriver - WebDriver for Chrome - Capabilities and ChromeOptions (chromium.org)

https://github.com/seleniumHQ

https://www.selenium.dev/documentation/