- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图通过使用方法“eyes.testResponseTime(driver, appName, testName, action, deadline, timeout, viewportSize);”来测试页面的“加载时间”下面的脚本,我得到了上面提到的错误。该方法来自“Applitools”(用于视觉验证)。请帮助我解决这个问题并给我一个如何有效使用此方法的解决方案,请给我一个简单的工作代码。提前致谢...
代码:
import java.net.URI;
import java.net.URISyntaxException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import com.applitools.eyes.Eyes;
import com.applitools.eyes.StdoutLogHandler;
public class LoadTime {
public static void main(String[] args) {
Eyes eyes =null;
WebDriver driver =null;
try {
driver = new FirefoxDriver();
eyes = new Eyes(new URI("https://applitools.com"));
eyes.setApiKey("Type_Applitools_Key_Here");
eyes.setLogHandler(new StdoutLogHandler(true));
// Load the applitools login page.
driver.get("https://applitools.com/login/");
// Enter the username and password. But don't click on "Login" just yet.
driver.findElement(By.id("user_login")).sendKeys("Enter User Name");
driver.findElement(By.id("user_pass")).sendKeys("Enter Password");
Thread.sleep(4000);
try {
eyes.testResponseTime(driver, "Applitools Website", "Login performance test 1",
// We want time to be measured from when we click on the
// "Login" button.
new Eyes.WebDriverAction() {
public void drive(WebDriver driver) {
driver.findElement(By.id("wp-submit")).click();
}
}, 20,new RectangleSize(1024, 600));
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} finally {
eyes.abortIfNotClosed();
driver.quit();
}
}
}
方法中出现错误: eyes.testResponseTime() 请引用上面的代码。
Pom.xml:
<project
xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId> T_TestSuite</groupId>
<artifactId>T_TestSuite</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name></name>
<description>AutomateT</description>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.7</jdk.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<compilerArgument></compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<buildnumber>${build.number}</buildnumber>
<jobname>${job.name}</jobname>
</systemPropertyVariables>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
<property>
<name>listener</name>
<value>org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter,com.automateon.TestProgressListener</value>
</property>
</properties>
<reportsDirectory>${project.basedir}/target/</reportsDirectory>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<build.number>${BUILD_NUMBER}</build.number>
<job.name>${JOB_NAME}</job.name>
</properties>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.52.0</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>LATEST</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.3</version>
<type>jar</type>
<classifier>jdk15</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
<type>jar</type>
<scope>compile</scope>
<optional>false</optional>
</dependency>
<dependency>
<groupId>RealTimeReports</groupId>
<artifactId>RealTimeReports</artifactId>
<version>1.0</version>
<classifier>jar-with-dependencies</classifier>
<scope>system</scope>
<systemPath>${project.basedir}/lib/RealTimeReports.jar</systemPath>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.applitools</groupId>
<artifactId>eyes-selenium-java</artifactId>
<version>2.32</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.22.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.22.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.8.7</version>
</dependency>
</dependencies>
</project>
控制台日志:
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
2016-05-03T16:12:17Z Eyes: openBase():Agent = eyes.selenium.java/2.31
2016-05-03T16:12:17Z Eyes: openBase():openBase('AppTest', 'Login Test', 'null')
2016-05-03T16:12:17Z Eyes: openBase():Eyes server URL is 'https://applitools.com'
2016-05-03T16:12:17Z Eyes: openBase():Timeout = '300000'
2016-05-03T16:12:17Z Eyes: openBase():matchTimeout = '2'
2016-05-03T16:12:17Z Eyes: openBase():Default match settings = 'Match level: STRICT, Exact match settings: null'
2016-05-03T16:12:17Z Eyes: openBase():FailureReports = 'ON_CLOSE'
2016-05-03T16:12:17Z Eyes: <init>():Driver session is 7XXXXXXXXXXXXXXXXXXXXX2
2016-05-03T16:12:17Z Eyes: testResponseTimeBase():testResponseTimeBase(regionProvider, 10, 30, 5000)
2016-05-03T16:12:17Z Eyes: testResponseTimeBase():No running session, calling start session..
2016-05-03T16:12:17Z Eyes: startSession():startSession()
2016-05-03T16:12:17Z Eyes: getDefaultContentViewportSize():getDefaultContentViewportSize()
2016-05-03T16:12:17Z Eyes: <init>():Frame chain copy constructor (size 0)
2016-05-03T16:12:17Z Eyes: <init>():Done!
2016-05-03T16:12:17Z Eyes: getDefaultContentViewportSize():Extracting viewport size...
2016-05-03T16:12:17Z Eyes: extractViewportSize():extractViewportSize()
2016-05-03T16:12:17Z Eyes: executeScript():Execute script...
2016-05-03T16:12:17Z Eyes: executeScript():Done!
2016-05-03T16:12:17Z Eyes: getDefaultContentViewportSize():Done! Viewport size: 1010x452
2016-05-03T16:12:17Z Eyes: startSession():No batch set
2016-05-03T16:12:17Z Eyes: getUserAgent():user agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
2016-05-03T16:12:17Z Eyes: getAppEnvironment():No OS set, checking for mobile OS...
2016-05-03T16:12:17Z Eyes: getAppEnvironment():No mobile OS detected.
2016-05-03T16:12:17Z Eyes: getAppEnvironment():Done!
2016-05-03T16:12:17Z Eyes: startSession():Application environment is [os = ? hostingApp = ? displaySize = 1010x452]
2016-05-03T16:12:17Z Eyes: startSession():Starting server session...
2016-05-03T16:12:17Z Eyes: abortIfNotClosed():Closed
Exception in thread "main" 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:336)
at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:221)
at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:59)
at com.applitools.eyes.Jersey2xServerConnector.startSession(Jersey2xServerConnector.java:145)
at com.applitools.eyes.EyesBase.startSession(EyesBase.java:1348)
at com.applitools.eyes.EyesBase.testResponseTimeBase(EyesBase.java:1017)
at com.applitools.eyes.Eyes.testResponseTime(Eyes.java:452)
at com.applitools.eyes.Eyes.testResponseTime(Eyes.java:532)
at com.TL.Test.TDB.LoadTime.main(LoadTime.java:49)
使用的引用资料:
1. http://support.applitools.com/customer/en/portal/articles/2167207-testing-your-page-s-loading-time?t=372225
2. https://eyes.applitools.com/app/tutorial.html
最佳答案
解决方法:我得到了输出并且工作正常。刚刚在新工作区上创建了一个新项目并添加了以下 maven 依赖项;
POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>VisualValidation</groupId>
<artifactId>VisualValidation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<source>1.3</source>
<target>1.2</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.52.0</version>
</dependency>
<dependency>
<groupId>com.applitools</groupId>
<artifactId>eyes-common-java</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.applitools</groupId>
<artifactId>eyes-sdk-java</artifactId>
<version>2.24</version>
</dependency>
<dependency>
<groupId>com.applitools</groupId>
<artifactId>eyes-selenium-java</artifactId>
<version>2.28</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.18.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.7.2</version>
</dependency>
</dependencies>
</project>
关于selenium - java.lang.NoSuchMethodError : javax. ws.rs.core.MultivaluedMap.addAll(Ljava/lang/Object;[Ljava/lang/Object;),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37009567/
来自 JSR-339: For simplicity, JAX-RS implementations are NOT REQUIRED to support processing groups oth
JAX-RS 提供了 StreamingOutput 接口(interface),我们可以实现它来对我们的响应主体进行原始流处理。 public interface StreamingOutput {
有没有办法获得java.lang.reflect.Method为给定的 @Path 调用的方法(用 HttpServletRequest 注释) ? 这是我的用例:我在 Java EE 中 Filte
我接到了一家公司的任务,该任务向我发送了一台已完成所有设置的虚拟机。任务是我必须创建一个 API 来从数据库中检索人员详细信息并显示它。 问题是,当我运行应用程序时,服务器返回一个包含 hello w
我有一个 POST 方法调用,它接受很少的表单参数。我希望 JAX-RS 能够处理不存在特定表单参数的情况。 示例: @POST @Produces (MediaType.APPLICATION_JS
我有 JAX-RS 网络应用程序,我想记录从获取请求到响应的时间量。在带有 servlet 过滤器的 Spring Boot 中很容易。但是我的应用程序中的过滤器无法正常工作: @Provider p
使用以下网址。 http://doma.in/context/resource/some/.../undefined 我想获取 ../resource 之后的路径名,即 /some/.../undef
Closed. This question is off-topic。它当前不接受答案。
我花了几个小时在嵌入式 Jetty 9.1.0.v20131115 和 RESTEasy 3.0.5.Final 中安装自定义登录服务。我的登录服务将在数据库中查找用户并为他们分配角色。它看起来像这样
RESOURCE_STALLS.RS的说明Intel Broadwell 的硬件性能事件如下: This event counts stall cycles caused by absence of
我想从 java 服务器 (Restful Jax-rs) 发送图像。我的客户是安卓。 @GET public Response getUserImage() { byte[] image =new
(特别是 RESTeasy) 具有如下方法签名会很好(对于单个文件): public void upload(@FormParam("name") ..., @FormParam("file") fi
RESTEasy (JAX-RS) 允许通过子资源进行动态调度。例如: POST /customers/create {"name":"Smith","country":"jp"} 我们可以有一个根资
假设有一个 ResultSet rs 和 n 对象。 这段代码: while(rs.next()) { // do something on rs } 在算法上等于此代码(即两者给出相同的结果)
我正在使用 Visual Studio 2005 和 mysql 4.0,我有一个表,其中包含一个字段(十进制 16,4),用于存储发票金额和另一个表,其中包含对该发票的付款(这些字段也是十进制的)
我正在使用 JAX-RS、Microprofile 和 Payara 5 构建 REST 服务。我的方法返回类型为 Response 的对象。响应本身包含一个 MyClass 列表。实现看起来像这样:
我已经使用 Mock MVC 成功地为 Spring MVC REST 服务构建了无需部署的集成测试框架。我正在努力对 JAX-RS 服务做同样的事情。 REST Assured 看起来很有希望,但它
我有一个使用JAX-RS 2.0的Jersey实现的Java应用程序,并且我想在客户端启用gzip压缩。服务器已启用它,并且通过在Chrome中的开发人员工具中的“大小/内容”中查找客户端正在使用的特
我正在尝试与 Tomcat7 一起使用 RESTful Web 服务 (JAX-RS)。我尝试了 3 种不同的实现(Jersey、RESTeasy 和 ReSTLet),但都没有成功。这应该很容易,但
swagger-api有什么区别和 JAX-RS ? 是swagger-api仅用于文档? (例如 @ApiOperation ) 最佳答案 根据 API 文档,JAX-RS是用于 RESTful W
我是一名优秀的程序员,十分优秀!