mercredi 27 avril 2016

Browserstack Selenium Automation HUB

I am following browserstack's documentation on using automation and currently getting an error and am abit confused about the URI.

My code looks like the following:

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://ift.tt/1eU1sYp"), 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();
    }
  }
}

I am confused about the uri http://ift.tt/1eU1sYp

I don't understand what is this URI ?

why is it needed for ?

why does this line of code http://ift.tt/1eU1sYp give me errors such as

"You must be authenticated to access this URL"

Status Code=403

The exact error is below

An exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll but was not handled in user code

Additional information: Unexpected error.

McAfee Web Gateway - Notification - Authentication Required

Authentication Required
<td class="contentData">

  You must be authenticated to access this URL.

</td>

urlprotocol = "http"; statuscode=403; if(statuscode==401 && urlprotocol == "ftp"){
  document.write("<form name=\"ftpform\" method=\"get\" action=\"\">");

  document.write("<table class=\"contentData\">");

  document.write("<tr><td class=\"contentData\" colspan=2>Please enter your credentials in the form below and click \"Access FTP\"

button if your browser doesn't present authentication prompt for FTP sites.");
  document.write("<tr><td class=\"contentData\">Username:</td><td><input type=\"text\"

id=\"ftpUsername\" name=\"ftpUsername\" size=40 />");
  document.write("<tr><td class=\"contentData\">Password:</td><td><input type=\"password\"

id=\"ftpPassword\" name=\"ftpPassword\" size=40 />");
  document.write("<tr><td class=\"contentData\" colspan=2 align=center><input type=\"button\" onclick=\"redirectToFTP();\"

value=\"Access FTP\" />");
  document.write("</table>");

  document.write("</form>");

} function redirectToFTP(){
  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"

}
<td class="infoData">

  <b>URL: </b><script type="text/javascript">break_line("http://ift.tt/26utpEP");</script><br />

</td>

Proxy: XXXXXXX

Rule: Authenticate: NTLM


I have just replaced the Proxy with XXXXXX

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.

any feedback is much appreciated, thank you.

Aucun commentaire:

Enregistrer un commentaire