Skip to content

Instantly share code, notes, and snippets.

@tourdedave
Last active July 8, 2019 16:01
Show Gist options
  • Save tourdedave/f7a848e9ea3a0f07d13aecd773dec6a3 to your computer and use it in GitHub Desktop.
Save tourdedave/f7a848e9ea3a0f07d13aecd773dec6a3 to your computer and use it in GitHub Desktop.
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
namespace sandbox
{
[TestFixture]
class Class1
{
IWebDriver Driver;
[SetUp]
public void SetUp()
{
Driver = new FirefoxDriver();
}
[TearDown]
public void TearDown()
{
Driver.Quit();
}
[Test]
public void ValidAccount()
{
Driver.Navigate().GoToUrl("http://the-internet.herokuapp.com/login");
Driver.FindElement(By.Id("username")).SendKeys("tomsmith");
Driver.FindElement(By.Id("password")).SendKeys("SuperSecretPassword!");
Driver.FindElement(By.CssSelector("button")).Click();
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="nunit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="Selenium.Support" Version="4.0.0-alpha01" />
<PackageReference Include="Selenium.WebDriver" Version="4.0.0-alpha01" />
</ItemGroup>
</Project>
Error Message:
System.IO.FileNotFoundException : Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at OpenQA.Selenium.Remote.Command.get_ParametersAsJsonString()
at OpenQA.Selenium.Remote.HttpCommandExecutor.HttpRequestInfo..ctor(Uri serverUri, Command commandToExecute, CommandInfo commandInfo)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxDriverService service, FirefoxOptions options, TimeSpan commandTimeout)
at sandbox.Class1.SetUp() in /Users/tourdedave/sandbox/Class1.cs:line 15
--TearDown
at sandbox.Class1.TearDown() in /Users/tourdedave/sandbox/Class1.cs:line 21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment