Tagged: Selenium C#

Selenium C# – Find Element by PartialLink Text

The below code can be used to detect any element on a WebPage by Partial LinkText using Selenium in C# //HTML Code <button class=’login’>Login into the site</button> //Corresponding Selenium C# Code WebDriver.FindElementByPartialLinkText(“Login”).Click(); //Code when...

Selenium C# – Find Element by TagName

The below code can be used to detect any element on a WebPage by TagName using Selenium in C# //HTML Code <button class=’login’>Login</button> //Corresponding Selenium C# Code WebDriver.FindElementByTagName(“button”).Click(); //Code when there is Custom function...

Selenium C# – Find Element by ClassName

The below code can be used to detect any element on a WebPage by ClassName using Selenium in C# //HTML Code <button class=”login”>Login</button> //Corresponding Selenium C# Code WebDriver.FindElementByClassName(“Login”).Click(); //Code when there is Custom function...

Selenium C# – Find Element by Name

The below code can be used to detect any element on a WebPage by Name using Selenium in C#   //HTML Code <button name=’login’>Login</button>” //Corresponding Selenium C# Code WebDriver.FindElementByName(“Login”).Click(); //Code when there is Custom...

Selenium C# – Find Element by LinkText

The below code can be used to detect any element on a WebPage by LinkText  using Selenium in C# LinkText indicates any text that is between “<A>” and “</A”> tag WebDriver.FindElementByLinkText(“Login”).Click(); //Code when there...

C# – Find Element by XPath in Selenium

The below code can be used to detect any element on a WebPage by XPath  using Selenium in C# WebDriver.FindElementByXPath(“//input[@id=’login’]”).Click(); //Code when there is Custom function int WaitTime=10; WebDriver.FindElement(By.XPath(“//input[@id=’login’]”),WaitTime).Click(); If there is a custom...

Alert Exception in Selenium & C#

Alert exception occurs whenever a alert occurs for which we have not coded in selenium to accept the alert (or) Sometimes alerts also occurs due to invalid input The Alert Exception in C# can...