0
I’m taking some automation classes with Selenium with the C# language and when I compile asks for the proper main method that I’ve tried in several ways
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Drawing.Imaging;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Chrome;
using System.IO;
using System.Collections;
namespace SeleniumTests
{
[TestFixture]
public class NomeDoProjeto
{
public IWebDriver driver;
private string baseURL;
public string screenshotsPasta;
int contador = 1;
//Método para capturar screenshot da tela
public void Screenshot(IWebDriver driver, string screenshotsPasta)
{
ITakesScreenshot camera = driver as ITakesScreenshot;
Screenshot foto = camera.GetScreenshot();
foto.SaveAsFile(screenshotsPasta, ScreenshotImageFormat.Png);
}
[SetUp]
public void SetupTest()
{
driver = new ChromeDriver();
driver.Manage().Window.Maximize();
baseURL = "https://www.google.com";
screenshotsPasta = @"C:\Users\cciola\Documents\Visual Studio 2013\Projects\TesteGit\Evidencias\";
}
public void capturaImagem()
{
Screenshot(driver, screenshotsPasta + "Imagem_" + contador++ + ".png");
Thread.Sleep(500);
}
[TearDown]
public void TeardownTest()
{
try
{
driver.Quit();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
}
[Teste]
public void NomeDoTeste()
{
driver.Navigate().GoToUrl(baseURL + "/intl/pt-BR/about/");
Thread.Sleep(1000);
capturaImagem();
Thread.Sleep(1000);
}
}
}
Main is program entry point, that’s where your program starts. Read this here.
– Augusto Vasques
And where is the
Main()
?– Leandro Angelo