Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# APPlitools:401 unauthorized在执行checkWindow()函数期间显示_C#_Selenium Webdriver_Selenium Chromedriver_Applitools - Fatal编程技术网

C# APPlitools:401 unauthorized在执行checkWindow()函数期间显示

C# APPlitools:401 unauthorized在执行checkWindow()函数期间显示,c#,selenium-webdriver,selenium-chromedriver,applitools,C#,Selenium Webdriver,Selenium Chromedriver,Applitools,我使用了您网站上的以下代码,并从我的帐户中提供了我的APIKEY。将启动url并设置浏览器大小。当第一个checkWindow()函数执行时,我得到一个未经授权的异常 using System; using System.Drawing; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using Applitools; namespace MyTests { public class TestApplitoolsWebsit

我使用了您网站上的以下代码,并从我的帐户中提供了我的
APIKEY
。将启动url并设置浏览器大小。当第一个
checkWindow()
函数执行时,我得到一个未经授权的异常

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();
            }
        }
    }
}

Applitools API的主要目的是,它将拍摄屏幕截图,并与我本地的基线屏幕截图进行比较。但是在这个
checkWindow()
函数中,我得到了一个异常。

401 Unauthorized的原因可能是:
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();
            }
        }
    }
}
1) 错误的API密钥。 2) 未设置服务器(针对私有云/在prem上)

你有专门的云吗?如果不是,请检查以确保您的API密钥是正确的


如果是,但仍不起作用,请联系Applitools团队support@applitools.com他们会很乐意帮忙的

如果不知道
类眼睛
,就什么都说不出来。你能分享一下Eyes在做什么吗?JavaScript也是如此