Skip to content

Instantly share code, notes, and snippets.

@bharathmuddada
bharathmuddada / SwitchCaseExample.cs
Created July 14, 2022 06:18
Example program for switch case
public class SwitchCaseExample
{
public static void Main(String[] args)
{
Console.WriteLine("Enter any of the 3 seasons Summer , Winter, Rainy ");
string season = Console.ReadLine();
switch (season) {
case "Summer":
Console.WriteLine($"{season} lasts from March to May");
break;
@bharathmuddada
bharathmuddada / PalindromeCheck.cs
Created July 15, 2022 03:11
Check whether given string is palindrome
public class PalindromeCheck
{
public static void Main(String[] args)
{
// Palindrome -- Level
//1. Reverse string.
//2. Compare the reversedstring with actual string.
string actualString = "level";
@bharathmuddada
bharathmuddada / RectangularArray.cs
Created July 18, 2022 13:55
Access elements from rectangular Array
public class RectangularArray
{
public static void Main(String[] args)
{
var rectangularArray = new int[,] {
{1,2,3 },
{4,5,6 },
{7,8,9}
};
@bharathmuddada
bharathmuddada / JaggedArraySample.cs
Created July 18, 2022 14:06
Accessing elements from jagged Array
public class JaggedArraySample
{
public static void Main(String[] args)
{
var jaggedArray = new int[][] {
new int[] {1,2,3 },
new int[] {4,5,6,7 },
new int[] {8,9,10,11,12}
};
@bharathmuddada
bharathmuddada / StringReversal.cs
Created July 18, 2022 15:03
Reversing String
public class StringReversal
{
public static void Main(String[] args)
{
string courseName1 = "Automation";
//Reversing String Approach -01
for (int i = courseName1.Length-1;i>=0 ; i--) {
@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 {
@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 / 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 / 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 / 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();