首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由于com.applitools.eyes.EyesException,应用程序openBase()失败

由于com.applitools.eyes.EyesException,应用程序openBase()失败
EN

Stack Overflow用户
提问于 2019-08-23 20:17:34
回答 2查看 1K关注 0票数 0

我无法弄清楚为什么这段代码会失败,我浏览了Applitools教程,也弄不明白这里发生了什么。

这是抛出的异常:

代码语言:javascript
复制
com.applitools.eyes.EyesException: eyes.openBase() failed

                at com.applitools.eyes.EyesBase.openBase(EyesBase.java:1037)
                at com.applitools.eyes.selenium.SeleniumEyes.open(SeleniumEyes.java:246)
                at com.applitools.eyes.selenium.Eyes.open(Eyes.java:77)
                at com.applitools.eyes.selenium.Eyes.open(Eyes.java:1374)
                at BaseTests.validateWindow(BaseTests.java:49)
                at SearchTests.testSearchByFullTitle(SearchTests.java:11)

这是SearchTests:

代码语言:javascript
复制
import org.junit.Test;

public class SearchTests extends BaseTests {

    @Test
    public void testSearchByFullTitle(){
        String title = "Agile Testing";
        page.search(title);
        validateWindow();
    }
}

验证窗口方法:

代码语言:javascript
复制
public void validateWindow(){
    eyes.open(driver, "Automation Bookstore", "neka metoda npr: "+
            Thread.currentThread().getStackTrace()[2].getMethodName());
    eyes.checkWindow();
    eyes.close();
}

抛出异常的类:

代码语言:javascript
复制
protected void openBase() throws EyesException {
    openLogger();
    int retry = 0;
    do {
        try {
            if (isDisabled) {
                logger.verbose("Ignored");
                return;
            }

            sessionEventHandlers.testStarted(getAUTSessionId());

            validateApiKey();
            logOpenBase();
            validateSessionOpen();

            initProviders();

            this.isViewportSizeSet = false;

            sessionEventHandlers.initStarted();

            beforeOpen();

            RectangleSize viewportSize = getViewportSizeForOpen();
            viewportSizeHandler.set(viewportSize);

            try {
                if (viewportSize != null) {
                    ensureRunningSession();
                }
            } catch (Exception e) {
                GeneralUtils.logExceptionStackTrace(logger, e);
                retry++;
                continue;
            }

            this.validationId = -1;

            isOpen = true;
            afterOpen();
            return;
        } catch (EyesException e) {
            logger.log(e.getMessage());
            logger.getLogHandler().close();
            throw e;
        }


    } while (MAX_ITERATION > retry);

    throw new EyesException("eyes.openBase() failed");
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-08-23 21:36:48

经过一些调试后,我发现我的API键有一个拼写错误。修复后,将按预期工作。

票数 0
EN

Stack Overflow用户

发布于 2019-11-18 21:10:09

在我的例子中,使用null作为testName参数的值也会导致同样的问题。

我从一开始就不理解它,因为我依赖于open函数的javadoc:

代码语言:javascript
复制
    /**
     * Starts a test.
     *
     * @param driver   The web driver that controls the browser hosting                 the application under test.
     * @param appName  The name of the application under test.
     * @param testName The test name.                 (i.e., the visible part of the document's body) or                 {@code null} to use the current window's viewport.
     * @return A wrapped WebDriver which enables SeleniumEyes trigger recording and frame handling.
     */
    public WebDriver open(WebDriver driver, String appName, String testName) {
        RectangleSize viewportSize = SeleniumEyes.getViewportSize(driver);
        this.configuration.setAppName(appName);
        this.configuration.setTestName(testName);
        this.configuration.setViewportSize(viewportSize);
        return open(driver);
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57626198

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档