3

I used the code below from your website and also provided my APIKEY from my account. The url is launched and the browser size is also set. When the first checkWindow() function executes, I get a 401 Unauthorized exception.

using System;
using System.Drawing;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using Applitools;

namespace MyTests
{
    public class TestApplitoolsWebsite
    {
        public static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();

            // This is your api key, make sure you use it in all your tests.
            var eyes = new Eyes();
            eyes.ApiKey = "YOUR_API_KEY";

            try
            {
                // Start visual testing with browser viewport set to 1024x768.
                // Make sure to use the returned driver from this point on.
                driver = eyes.Open(driver, "Applitools", "Test Web Page", new Size(1024, 768));

                driver.Navigate().GoToUrl("http://www.applitools.com");

                // Visual validation point #1
                eyes.CheckWindow("Main Page");

                driver.FindElement(By.CssSelector(".features>a")).Click();

                // Visual validation point #2
                eyes.CheckWindow("Features Page");

                // End visual testing. Validate visual correctness.
                eyes.Close();
            }
            finally
            {
                eyes.AbortIfNotClosed();
                driver.Quit();
            }
        }
    }
}

The main purpose of Applitools API is that it will take screen shot and it will compare with baseline screen shot from my local. But during this checkWindow() function i get the exception.

Artless
  • 4,522
  • 1
  • 25
  • 40
johny
  • 51
  • 1
  • 11

1 Answers1

3

the reasons for 401 Unauthorized could be: 1) Wrong API key. 2) Not setting a server (for private clouds/on prem).

Do you have a dedicated cloud? If not, check to make sure that your API key is correct.

If it is and it is still not working, contact the Applitools team at support@applitools.com and they will be glad to assist.