On saucelabs website they provide a code snippet like this:
WebDriver webDriver = new WebDriver();
webDriver.set(new RemoteWebDriver(
new URL("https://UrlHEREagwgwgqwg4894+4+91gwgq")
))
When I add this to my tests, under WebDriver it says type or namespace 'WebDriver' could not be found. It is coming up for a namespace. For my Selenium tests I am using IWebDriver. I tried to change the WebDriver to IWebDriver and that didn't work. I also get the same error under the URL saying the namespace could not be found. For that one it does show for a namespace using System.Security.Policy; If I add that then I get an error under
new URL("https://UrlHEREagwgwgqwg4894+4+91gwgq")
Argument 1: cannot convert from 'System.Security.Policy.Url' to 'OpenQA.Selenium.DriverOptions'
This is how I am trying to use it. I was using ChromeDriver for my selenium tests but commented that part out to test on other browsers with saucelabs. This is my first time working with selenium/saucelabs so what I am doing my be completely off and I appreciate any advice.
[Fact]
public static void ClickDownloadButton()
{
WebDriver driver = new WebDriver();
driver.set(new RemoteWebDriver(
new Url("https://UrlHEREagwgwgqwg4894+4+91gwgq")
));
//using IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl(BaseUrl.downloadsUrl);
var login = new Login(driver);
login.EnterEmail();
login.EnterPassword();
login.HitSubmit();
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
var downloadButton = wait.Until((d) => d.FindElements(By.LinkText("Download File")));
foreach (var button in downloadButton)
{
IWebElement element = wait.Until((d) => d.FindElement(By.LinkText("Download File")));
element.Click();
}
driver.Quit();
}
Here are the using statements:
using Xunit;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
using System;
using System.IO;
using System.Security.Policy;
using OpenQA.Selenium.Remote;