comment out safari and edge. Neither works in .Net on Mac
This commit is contained in:
parent
e0fa52305e
commit
e0fb9e5255
@ -3,6 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "weehawken", "weehawken\weehawken.csproj", "{DFE29179-A415-483E-B483-B9D21127CD14}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A739F328-98F9-4F32-8027-B12E993B8375}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -4,6 +4,8 @@ using OpenQA.Selenium.Edge;
|
||||
using OpenQA.Selenium.Firefox;
|
||||
using OpenQA.Selenium.Remote;
|
||||
using OpenQA.Selenium.Safari;
|
||||
using WebDriverManager;
|
||||
using WebDriverManager.DriverConfigs.Impl;
|
||||
|
||||
namespace weehawken
|
||||
{
|
||||
@ -18,9 +20,9 @@ namespace weehawken
|
||||
case "firefox":
|
||||
return GetFirefox(headless);
|
||||
case "safari":
|
||||
return getSafari(false); //headless not supported
|
||||
return GetSafari(false); //headless not supported
|
||||
case "edge":
|
||||
return getEdge(headless); //headless only available in Selenium 4
|
||||
return GetEdge(headless); //headless only available in Selenium 4
|
||||
default:
|
||||
throw new ArgumentException("Invalid browser specified");
|
||||
}
|
||||
@ -53,14 +55,34 @@ namespace weehawken
|
||||
return driver;
|
||||
}
|
||||
|
||||
private static RemoteWebDriver getSafari(bool headless)
|
||||
private static RemoteWebDriver GetEdge(bool headless)
|
||||
{
|
||||
return new SafariDriver();
|
||||
//new DriverManager().SetUpDriver(new EdgeConfig());
|
||||
EdgeOptions opts = new EdgeOptions();
|
||||
if (headless)
|
||||
{
|
||||
opts.AddArguments("headless");
|
||||
}
|
||||
opts.AcceptInsecureCertificates = true;
|
||||
RemoteWebDriver driver = new EdgeDriver(opts);
|
||||
return driver;
|
||||
}
|
||||
|
||||
private static RemoteWebDriver getEdge(bool headless)
|
||||
private static RemoteWebDriver GetSafari(bool headless)
|
||||
{
|
||||
return new EdgeDriver();
|
||||
String os = Environment.OSVersion.ToString();
|
||||
if (os.Contains("Win")){
|
||||
throw new NotSupportedException("Safari is not supported on Windows");
|
||||
}
|
||||
//SafariOptions opts = new SafariOptions();
|
||||
if (headless)
|
||||
{
|
||||
throw new NotSupportedException("Safari does not support headless operation");
|
||||
}
|
||||
//opts.AcceptInsecureCertificates = true;
|
||||
RemoteWebDriver driver = new SafariDriver();
|
||||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
|
||||
return driver;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,34 @@ namespace weehawken
|
||||
RemoteWebElement results =
|
||||
(RemoteWebElement)driver.FindElementByPartialLinkText("Monster cereal");
|
||||
Assert.NotNull(results);
|
||||
driver.Quit();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Safari implementation is broken in .Net")]
|
||||
public void SafariTest()
|
||||
{
|
||||
Console.WriteLine("Safari Test");
|
||||
driver = BrowserDriver.GetDriver("safari", false); //no headless for safari
|
||||
driver.Navigate().GoToUrl(url);
|
||||
driver.FindElementByXPath("//input[@id='search_form_input_homepage']")
|
||||
.SendKeys("frankenberries" + Keys.Enter);
|
||||
RemoteWebElement results =
|
||||
(RemoteWebElement)driver.FindElementByPartialLinkText("Monster cereal");
|
||||
Assert.NotNull(results);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Edge Implementation is broken in .Net for MAC")]
|
||||
public void EdgeTest()
|
||||
{
|
||||
Console.WriteLine("Edge Test");
|
||||
//driver = BrowserDriver.GetDriver("edge", true);
|
||||
driver.Navigate().GoToUrl(url);
|
||||
driver.FindElementByXPath("//input[@id='search_form_input_homepage']")
|
||||
.SendKeys("frankenberries" + Keys.Enter);
|
||||
RemoteWebElement results =
|
||||
(RemoteWebElement)driver.FindElementByPartialLinkText("Monster cereal");
|
||||
Assert.NotNull(results);
|
||||
}
|
||||
}
|
||||
}
|
BIN
weehawken/drivers/msedgedriver
Executable file
BIN
weehawken/drivers/msedgedriver
Executable file
Binary file not shown.
@ -18,6 +18,7 @@
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
<PackageReference Include="BoDi" Version="1.4.1" />
|
||||
<PackageReference Include="WebDriverManager" Version="2.11.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -28,5 +29,6 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="Harness\" />
|
||||
<Folder Include="Tests\" />
|
||||
<Folder Include="drivers\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user