36 lines
770 B
C#
36 lines
770 B
C#
using OpenQA.Selenium;
|
|
using OpenQA.Selenium.Firefox;
|
|
|
|
[TestClass]
|
|
public class TestGoogleSearch
|
|
{
|
|
private IWebDriver driver;
|
|
|
|
[TestInitialize]
|
|
public void SetUp()
|
|
{
|
|
driver = new FirefoxDriver();
|
|
driver.Navigate().GoToUrl("https://www.google.com/");
|
|
|
|
// potvrzení přijetí všech požadavků
|
|
IAlert alert = driver.SwitchTo().Alert();
|
|
alert.Accept();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestSearch()
|
|
{
|
|
IWebElement searchInput = driver.FindElement(By.Name("q"));
|
|
searchInput.SendKeys("test");
|
|
searchInput.Submit();
|
|
|
|
Assert.AreEqual(driver.Url, "https://www.google.com/search?q=test");
|
|
}
|
|
|
|
[TestCleanup]
|
|
public void TearDown()
|
|
{
|
|
driver.Quit();
|
|
}
|
|
}
|