-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
51 lines (44 loc) · 1.58 KB
/
Copy pathProgram.cs
File metadata and controls
51 lines (44 loc) · 1.58 KB
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
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
class TesteSelenium
{
static void Main(string[] args)
{
// Configura o ChromeDriver
ChromeOptions options = new ChromeOptions();
options.AddArgument("--start-maximized");
IWebDriver driver = new ChromeDriver(options);
// Define a URL da página de teste
string url = "https://www.calculadoraonline.com.br/calculadora-virtual-gratis";
// Acessa a página de teste
driver.Navigate().GoToUrl(url);
// Localiza os elementos da página
IWebElement botao2 = driver.FindElement(By.Id("b18"));
IWebElement botaoMais = driver.FindElement(By.Id("b4"));
IWebElement botao3 = driver.FindElement(By.Id("b19"));
IWebElement botaoIgual = driver.FindElement(By.Id("b27"));
IWebElement campoResultado = driver.FindElement(By.Id("TIExp"));
// Realiza as interações do usuário
botao2.Click();
Thread.Sleep(3000);
botaoMais.Click();
Thread.Sleep(3000);
botao3.Click();
Thread.Sleep(3000);
botaoIgual.Click();
Thread.Sleep(3000);
// Verifica o resultado
string resultadoEsperado = "5";
string resultadoObtido = campoResultado.GetAttribute("value");
if (resultadoObtido == resultadoEsperado)
{
Console.WriteLine("Teste passou!");
}
else
{
Console.WriteLine("Teste falhou!");
}
// Fecha o navegador
driver.Quit();
}
}