-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
35 lines (29 loc) · 997 Bytes
/
Program.cs
File metadata and controls
35 lines (29 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using System.Threading;
class Program
{
static void Main(string[] args)
{
// Start Chrome browser
using (IWebDriver driver = new ChromeDriver())
{
driver.Navigate().GoToUrl("https://app.cloudqa.io/home/AutomationPracticeForm");
// 1. First Name (by name)
var firstName = driver.FindElement(By.Name("firstname"));
firstName.Clear();
firstName.SendKeys("John");
// 2. Gender (by value)
var genderMale = driver.FindElement(By.CssSelector("input[value='Male']"));
genderMale.Click();
// 3. Date (by id)
var dateField = driver.FindElement(By.Id("datepicker"));
dateField.Clear();
dateField.SendKeys("01/01/2024");
// Optional: Wait to see the result before closing
Thread.Sleep(3000);
driver.Quit();
}
}
}