-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test01.cs
53 lines (45 loc) · 1.4 KB
/
Test01.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
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
/*
* Test Project #1: User Login Form
* Goal: set outline for test plan
* Introduction to Selenium WebDriver
* Prepare environment (Selenium, Firefox, NUnit)
* Parameterize data with variables
*/
namespace TestingProject01
{
class Test01
{
[Test]
public void LogInTest()
{
// Step 7: Initialize properties
IWebDriver driver;
string webUrl;
string email = "tim@testemail.com";
string password;
// Step 1: Open Browser
driver = new FirefoxDriver();
// Step 2: Navigate to Test Page
driver.Navigate().GoToUrl("http://sdettraining.com/trguitransactions/Account.aspx");
Thread.Sleep(1000);
// Step 3: Enter username
driver.FindElement(By.Id("MainContent_txtUserName")).SendKeys(email);
// Step 4: Enter password
driver.FindElement(By.Id("MainContent_txtPassword")).SendKeys("password");
Thread.Sleep(2000);
// Step 5: Click login
driver.FindElement(By.Id("MainContent_btnLogin")).Click();
// Step 6: Assert
// Code comes later
}
}
}