-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnitTest1.cs
43 lines (37 loc) · 1.49 KB
/
UnitTest1.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
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
using System.Threading;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
static IWebDriver driverFF;
static IWebDriver driverGC;
[TestMethod]
public void TestFirefoxDriver()
{
driverFF = new FirefoxDriver();
driverFF.Navigate().GoToUrl("http://www.google.com");
driverFF.FindElement(By.Id("lst-ib")).SendKeys("Selenium");
driverFF.FindElement(By.Id("lst-ib")).SendKeys(Keys.Enter);
//driverFF.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
Thread.Sleep(5000);
//WebDriverWait wait = new WebDriverWait(driverFF, TimeSpan.FromSeconds(10));
//wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.LinkText("Selenium - Web Browser Automation")));
driverFF.Navigate().GoToUrl("http://www.google.com");
}
[TestMethod]
public void TestChromeDriver()
{
driverGC = new ChromeDriver({{path_to_chrome_driver}});
driverGC.Navigate().GoToUrl("http://www.google.com");
driverGC.FindElement(By.Id("lst-ib")).SendKeys("Selenium");
driverGC.FindElement(By.Id("lst-ib")).SendKeys(Keys.Enter);
}
}
}