-
Notifications
You must be signed in to change notification settings - Fork 0
/
selenium_icici.cs
74 lines (59 loc) · 2.22 KB
/
selenium_icici.cs
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Open visual studio new project, search for xUnit project with c# and create
* check required packages are installed
*
* <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.3.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="103.0.5060.5300" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
*/
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using Xunit;
namespace IciciBankProject
{
public class UnitTest1 : IDisposable
{
private IWebDriver _driver;
// Got a build error when below constructor name is not same as class name
public UnitTest1()
{
_driver = new ChromeDriver();
_driver.Manage().Window.Maximize();
}
[Fact]
public void ToOpen_IciciBankMainPage()
{
_driver.Navigate().GoToUrl("https://www.icicibank.com/");
Assert.Equal("Personal Banking & Netbanking Services Online - ICICI Bank", _driver.Title);
var clickLaterButton = _driver.FindElement(By.Id("push-modal-close"));
clickLaterButton.Click();
var clickLoginButton = _driver.FindElement(By.Id("login-btn"));
clickLoginButton.Click();
Assert.Equal("Log in to Internet Banking", _driver.Title);
}
public void Dispose()
{
_driver.Quit();
}
}
}