Skip to content

Instantly share code, notes, and snippets.

@bharathmuddada
bharathmuddada / SeleniumFluentWait.cs
Created August 9, 2022 23:39
C# Selenium Fluent Wait Example
public class SeleniumFluentWait {
public static void Main(string[] args)
{
new DriverManager().SetUpDriver(new ChromeConfig());
var driver = new ChromeDriver();
driver.Manage().Window.Maximize();
@bharathmuddada
bharathmuddada / SeleniumExplicitWaitExample.cs
Last active August 9, 2022 23:37
C# Selenium Program for Explicit Wait
public class SeleniumExplicitWaitExample {
public static void Main(string[] args)
{
new DriverManager().SetUpDriver(new ChromeConfig());
var driver = new ChromeDriver();
driver.Manage().Window.Maximize();
@bharathmuddada
bharathmuddada / SeleniumImplicitWait.cs
Created August 9, 2022 22:50
C# Selenium Implicit Wait Example
public class SeleniumImplicitWait {
public static void Main(string[] args)
{
new DriverManager().SetUpDriver(new ChromeConfig());
var driver = new ChromeDriver();
driver.Manage().Window.Maximize();
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
@bharathmuddada
bharathmuddada / SeleniumJSAlertSample.cs
Last active August 9, 2022 00:36
C# Selenium Program to handle javascript alerts
public class SeleniumJSAlertSample {
public static void Main(string[] args)
{
new DriverManager().SetUpDriver(new ChromeConfig());
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://the-internet.herokuapp.com/javascript_alerts");
driver.Manage().Window.Maximize();
@bharathmuddada
bharathmuddada / HoverExample.cs
Created August 7, 2022 16:05
Selenium c# program to hover over a element
public class HoverExample {
public static void Main(string[] args) {
new DriverManager().SetUpDriver(new ChromeConfig());
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://the-internet.herokuapp.com/hovers");
driver.Manage().Window.Maximize();
@bharathmuddada
bharathmuddada / RightClickDoubleClick.cs
Created August 7, 2022 15:30
Selenium C# script examples for RIght Click and Double Click example
public class RightClickDoubleClick {
public static void Main(string[] args) {
new DriverManager().SetUpDriver(new ChromeConfig());
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://demo.guru99.com/test/simple_context_menu.html");
driver.Manage().Window.Maximize();
@bharathmuddada
bharathmuddada / SeleniumCopyPaste.cs
Created August 7, 2022 10:37
C# Selenium Program to copy paste text
public class SeleniumSample {
public static void Main(string[] args) {
new DriverManager().SetUpDriver(new ChromeConfig());
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://www.google.com/");
driver.Manage().Window.Maximize();
var search_field = driver.FindElement(By.Name("q"));
search_field.SendKeys("Selenium");
@bharathmuddada
bharathmuddada / GoogleResults.cs
Created August 4, 2022 05:21
Selenium C# program to fetch all the links from the google search results.
public class GoogleResults {
public static void Main(string[] args) {
new DriverManager().SetUpDriver(new ChromeConfig());
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://www.google.com/");
driver.Manage().Window.Maximize();
@bharathmuddada
bharathmuddada / DropDownSample.cs
Created August 4, 2022 05:13
Dropdown example with Selenium C#
public class DropDownSample {
public static void Main(string[] args)
{
new DriverManager().SetUpDriver(new ChromeConfig());
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://the-internet.herokuapp.com/dropdown");
driver.Manage().Window.Maximize();
@bharathmuddada
bharathmuddada / SeleniumAllLocators.cs
Created August 3, 2022 04:12
Selenium C# Program with all Locators
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Edge;
using WebDriverManager;
using WebDriverManager.DriverConfigs.Impl;
using OpenQA.Selenium.Support.UI;
namespace LearnSelenium {
public class SeleniumAllLocators {