This commit is contained in:
Lukáš Kaňka
2023-08-22 20:28:19 +02:00
commit 14d46cad1c
2236 changed files with 74214 additions and 0 deletions

View File

@ -0,0 +1,51 @@
using Xunit;
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace Google_Search_xUnit;
public class UnitTest1
{
[Fact]
public void Test1()
{
// Otevře stránku google
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://www.google.com");
driver.Manage().Window.Maximize();
// zamítne cookies google (odmítnout vše)
IWebElement addButton = driver.FindElement(By.Id("W0wltc"));
addButton.Click();
// napíše slovo test do vyhledávání a potvrdí
IWebElement searchBox = driver.FindElement(By.Name("q"));
searchBox.SendKeys("test");
searchBox.Submit();
Thread.Sleep(1000);
IWebElement zpet = driver.FindElement(By.Id("logo"));
zpet.Click();
// IWebElement gearButton = driver.FindElement(By.CssSelector("[class='your-css-class']"));
//gearButton.Click();
Thread.Sleep(2000);
driver.Quit();
}
}