C#
This commit is contained in:
51
Testing_Win/xUnit/Google_Search_xUnit/UnitTest1.cs
Normal file
51
Testing_Win/xUnit/Google_Search_xUnit/UnitTest1.cs
Normal 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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user