我使用了您网站上的以下代码,并APIKEY
从我的帐户中提供了我的代码。启动 url 并设置浏览器大小。当第一个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();
}
}
}
}
Applitools API 的主要目的是拍摄屏幕截图,并与我本地的基线屏幕截图进行比较。但是在这个checkWindow()
函数中我得到了异常。