-
-
Save muditlambda/b1ff68efd7a4aec65faa3fb21daae36d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using NUnit.Framework; | |
using OpenQA.Selenium; | |
using OpenQA.Selenium.Chrome; | |
using OpenQA.Selenium.Firefox; | |
using OpenQA.Selenium.IE; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Assert_Demo | |
{ | |
public class Browser_ops | |
{ | |
IWebDriver webDriver; | |
public void Init_Browser() | |
{ | |
webDriver = new ChromeDriver(); | |
webDriver.Manage().Window.Maximize(); | |
} | |
public string Title | |
{ | |
get { return webDriver.Title; } | |
} | |
public void Goto(string url) | |
{ | |
webDriver.Url = url; | |
} | |
public string Geturl | |
{ | |
get { return webDriver.Url; } | |
} | |
public void Close() | |
{ | |
webDriver.Quit(); | |
} | |
public IWebDriver getDriver | |
{ | |
get { return webDriver; } | |
} | |
} | |
class Assert_Demo_1 | |
{ | |
Browser_ops brow = new Browser_ops(); | |
String test_url = "https://www.lambdatest.com"; | |
[SetUp] | |
public void start_Browser() | |
{ | |
brow.Init_Browser(); | |
} | |
[Test] | |
public void test_asserturl() | |
{ | |
brow.Goto(test_url); | |
System.Threading.Thread.Sleep(4000); | |
String start_with_str = "cross"; | |
String end_with_str = "lambdatest"; | |
String site_title = brow.Title; | |
Console.WriteLine("The site title is " + site_title); | |
Assert.That(site_title, Does.StartWith(start_with_str).IgnoreCase); | |
Console.WriteLine("Site title " + site_title + " starts with " + start_with_str); | |
Assert.That(site_title, Does.EndWith(end_with_str).IgnoreCase); | |
Console.WriteLine("Site title " + site_title + " ends with " + end_with_str); | |
/* Perform wait to check the output */ | |
System.Threading.Thread.Sleep(2000); | |
} | |
[TearDown] | |
public void close_Browser() | |
{ | |
brow.Close(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment