Skip to content

Commit 3410f85

Browse files
committed
First commit
0 parents  commit 3410f85

File tree

97 files changed

+6569
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+6569
-0
lines changed

.vs/SeleniumBoilerplate/v16/.suo

14.5 KB
Binary file not shown.

SeleniumBoilerplate.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31313.79
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SeleniumBoilerplate", "SeleniumBoilerplate\SeleniumBoilerplate.csproj", "{8AE5D0D2-E488-4E82-84FF-2B205C065993}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{8AE5D0D2-E488-4E82-84FF-2B205C065993}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{8AE5D0D2-E488-4E82-84FF-2B205C065993}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{8AE5D0D2-E488-4E82-84FF-2B205C065993}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{8AE5D0D2-E488-4E82-84FF-2B205C065993}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {02C932D6-F3E8-415C-939E-98F44820A5E8}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace SeleniumBoilerplate.PageObjects
6+
{
7+
class SimplePage
8+
{
9+
}
10+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using Xunit;
5+
6+
namespace SeleniumBoilerplate.Scenarios
7+
{
8+
public class SimplePageTests : IClassFixture<StartupFixture>
9+
{
10+
StartupFixture fixture;
11+
12+
public SimplePageTests(StartupFixture fixture)
13+
{
14+
this.fixture = fixture;
15+
}
16+
17+
[Fact]
18+
public void AbrirNavegador()
19+
{
20+
var browser = fixture.InicializaDriver("chrome");
21+
22+
browser.Navigate().GoToUrl("www.google.com");
23+
}
24+
}
25+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
6+
<IsPackable>false</IsPackable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
11+
<PackageReference Include="Selenium.Chrome.WebDriver" Version="85.0.0" />
12+
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
13+
<PackageReference Include="xunit" Version="2.4.1" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
15+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
16+
<PrivateAssets>all</PrivateAssets>
17+
</PackageReference>
18+
<PackageReference Include="coverlet.collector" Version="1.3.0">
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20+
<PrivateAssets>all</PrivateAssets>
21+
</PackageReference>
22+
</ItemGroup>
23+
24+
</Project>

SeleniumBoilerplate/StartupFixture.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using OpenQA.Selenium;
2+
using OpenQA.Selenium.Chrome;
3+
using OpenQA.Selenium.Firefox;
4+
using System;
5+
using System.IO;
6+
using Xunit;
7+
8+
namespace SeleniumBoilerplate
9+
{
10+
public class StartupFixture : IDisposable
11+
{
12+
IWebDriver _driver;
13+
private char separador = Path.PathSeparator;
14+
15+
public IWebDriver InicializaDriver(string browser)
16+
{
17+
switch (browser)
18+
{
19+
case "chrome":
20+
_driver = new ChromeDriver();
21+
break;
22+
case "firefox":
23+
_driver = new FirefoxDriver();
24+
break;
25+
default:
26+
Console.WriteLine("Browser não é suportado!");
27+
break;
28+
}
29+
30+
return _driver;
31+
}
32+
33+
public void Dispose()
34+
{
35+
Screenshot screenshot = (_driver as ITakesScreenshot).GetScreenshot();
36+
37+
string ScreenshotDir = Path.Combine($"{Directory.GetCurrentDirectory()}{separador}Evidencias");
38+
39+
screenshot.SaveAsFile($"{ScreenshotDir}{DateTime.Now}", ScreenshotImageFormat.Png);
40+
41+
_driver.Quit();
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)