Browserstack Selenium Automation HUB
<p>I am following browserstack's <a href="https://www.browserstack.com/automate/c-sharp" rel="nofollow">documentation</a> on using automation and currently getting an error and am abit confused about the URI. </p>

<p>My code looks like the following: </p>

<pre><code>using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;

namespace SeleniumTest {
  class Program {
    static void Main(string[] args) {
      IWebDriver driver;
      DesiredCapabilities capability = DesiredCapabilities.Firefox();
      capability.SetCapability("browserstack.user", "USERNAME");
      capability.SetCapability("browserstack.key", "ACCESS_KEY");

      driver = new RemoteWebDriver(
        new Uri("http://hub.browserstack.com/wd/hub/"), capability
      );
      driver.Navigate().GoToUrl("http://www.google.com");
      Console.WriteLine(driver.Title);

      IWebElement query = driver.FindElement(By.Name("q"));
      query.SendKeys("Browserstack");
      query.Submit();
      Console.WriteLine(driver.Title);

      driver.Quit();
    }
  }
}
</code></pre>

<p>I am confused about the uri <code>http://hub.browserstack.com/wd/hub/</code></p>

<p>I don't understand what is this URI ? </p>

<p>why is it needed for ? </p>

<p>why does this line of code <code>http://hub.browserstack.com/wd/hub/</code> give me errors such as </p>

<blockquote>
  <p>"You must be authenticated to access this URL"</p>
  
  <p>Status Code=403</p>
</blockquote>

<p>The exact error is below </p>

<blockquote>
  <p>An exception of type 'OpenQA.Selenium.WebDriverException' occurred in
  WebDriver.dll but was not handled in user code</p>
  
  <p>Additional information: Unexpected error. </p>
  
  
  
  <p></p>
  
  
  
  <p></p>
  
  <p></p>
  
  <p></p>
  
  
  
  
  
  <p>McAfee Web Gateway - Notification - Authentication
  Required</p>
  
  <p></p>
  
  <p></p>
  
  
  
  
  
  <p></p>
  
  <p></p>
  
  <p></p>
  
  <p></p>
  
  <p></p>
  
  <p></p>
  
  <p></p>
  
  <p></p>
  
  <p></p>
  
  
  
  Authentication
  Required
  
  
  
  
  
    

<pre><code>&lt;td class="contentData"&gt;

  You must be authenticated to access this URL.

&lt;/td&gt;
</code></pre>
  
    
  
  
  
  
  
     urlprotocol = "http";
  
     statuscode=403;
  
  
  
     if(statuscode==401 && urlprotocol == "ftp"){

<pre><code>  document.write("&lt;form name=\"ftpform\" method=\"get\" action=\"\"&gt;");

  document.write("&lt;table class=\"contentData\"&gt;");

  document.write("&lt;tr&gt;&lt;td class=\"contentData\" colspan=2&gt;Please enter your credentials in the form below and click \"Access FTP\"
</code></pre>
  
  button if your browser doesn't present authentication prompt for FTP
  sites.");

<pre><code>  document.write("&lt;tr&gt;&lt;td class=\"contentData\"&gt;Username:&lt;/td&gt;&lt;td&gt;&lt;input type=\"text\"
</code></pre>
  
  id=\"ftpUsername\" name=\"ftpUsername\" size=40 />");

<pre><code>  document.write("&lt;tr&gt;&lt;td class=\"contentData\"&gt;Password:&lt;/td&gt;&lt;td&gt;&lt;input type=\"password\"
</code></pre>
  
  id=\"ftpPassword\" name=\"ftpPassword\" size=40 />");

<pre><code>  document.write("&lt;tr&gt;&lt;td class=\"contentData\" colspan=2 align=center&gt;&lt;input type=\"button\" onclick=\"redirectToFTP();\"
</code></pre>
  
  value=\"Access FTP\" />");

<pre><code>  document.write("&lt;/table&gt;");

  document.write("&lt;/form&gt;");
</code></pre>
  
     }
  
  
  
     function redirectToFTP(){

<pre><code>  var username=unescape(document.getElementById("ftpUsername").value);

  var password=unescape(document.getElementById("ftpPassword").value);

  location.href = "ftp://"+username+":"+password+"@hub.browserstack.com:80/wd/hub/session"
</code></pre>
  
     }
  
  
  
  
  
  
  
  
  
    

<pre><code>&lt;td class="infoData"&gt;

  &lt;b&gt;URL: &lt;/b&gt;&lt;script type="text/javascript"&gt;break_line("http://hub.browserstack.com/wd/hub/session");&lt;/script&gt;&lt;br /&gt;

&lt;/td&gt;
</code></pre>
  
    
  
  
  
  <p>Proxy: XXXXXXX</p>Rule: Authenticate: NTLM</p></p>
  
  
  
  
  
  <p><br/></p>
</blockquote>

<p>I have just replaced the Proxy with XXXXXX</p>

<p>I am also using a real fully licensed Browserstack Account Username/Password, but for the purpose of this question have the examples there. "USERNAME" for username and "ACCESS_KEY" for password.</p>

<p>any feedback is much appreciated, thank you.</p>