com.applitools.eyes.ServerConnector.startSession(ServerConnector.java:166)

com.applitools.eyes.ServerConnector.startSession(ServerConnector.java:166)

我正在尝试使用 Applitolls 测试一个简单的代码,但出现了上述错误。我已经在 POM 文件中添加了所有依赖项。

Error: java.lang.NoSuchMethodError: javax.ws.rs.core.MultivaluedMap.addAll(Ljava/lang/Object;[Ljava/lang/Object;)V at org.glassfish.jersey.client.ClientRequest.accept(ClientRequest.java:311) at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:198) at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:36) at com.applitools.eyes.ServerConnector.startSession(ServerConnector.java:166) at com.applitools.eyes.EyesBase.startSession(EyesBase.java:1694) at com.applitools.eyes.EyesBase.ensureRunningSession(EyesBase.java:1437) at com.applitools.eyes.EyesBase.openBase(EyesBase.java:1405) at com.applitools.eyes.selenium.Eyes.open(Eyes.java:331) at com.applitools.eyes.selenium.Eyes.open(Eyes.java:279) at com.dell.cm.systemIntegrationTest.Test.beforeTest(TestVxBlock.java:100)

代码:

public class TestAppli 
{
     WebDriver driver;
     Eyes eyes = new Eyes();
@BeforeTest 
public void beforeTest()
{
     eyes.setApiKey(""APPLITOOLS_API_KEY"");
     System.setProperty("webdriver.chrome.driver",
     "C:\CloudIQ\Automation\system-integration- 
     test\tools\selenium\chromedriver.exe");
     driver = new ChromeDriver();
     driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
     eyes.open(driver, "Test","LoginPage", new RectangleSize(700, 500));
     driver.get("https://demo.applitools.com");
}
@Test
public void mainTest()
{
 eyes.checkWindow("Login window"); 
}

@AfterTest
public void afterTest()
{
 eyes.close();
 driver.close(); 
 }
}

我能够解决它:

Eyes 默认使用 Jersey2.x。如果您使用的是Jersey1.x,请按以下步骤操作:

  1. 从 Eyes-selenium 依赖项中排除 eyes-connectivity-java3-jersey2x
  2. 为 eyes-connectivity 添加依赖项-java3-jersey1x

注意eyes connectivity的版本号要和Eyes-selenium一样