小编use*_*753的帖子

Selenium WebDriver如何解决过时的元素参考异常?

我在Selenium 2 Web驱动程序测试中有以下代码,它在我调试时有效,但是当我在构建中运行它时大部分时间都失败了.我知道它必须与页面没有刷新的方式有关,但不知道如何解决它所以任何关于我做错了什么的指针都很感激.我使用JSF primefaces作为我的Web应用程序框架.当我点击添加新链接时,会出现一个弹出对话框,其中包含一个我可以输入日期的输入框,然后单击保存.它是在输入元素输入文本,我得到一个陈旧的元素引用异常.

提前致谢

import static org.junit.Assert.assertEquals;

 import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;


public class EnterActiveSubmissionIntegrationTest {
Map<String, Map<String, String>> tableData = new HashMap<String, Map<String, String>>();

@Test
public void testEnterActiveSubmission() throws Exception {
    // Create a new instance of the Firefox driver
    // Notice that the remainder of the code relies on the interface, 
    // not the implementation.
    System.setProperty("webdriver.chrome.driver", "C:/apps/chromedriver.exe");
    WebDriver driver = …
Run Code Online (Sandbox Code Playgroud)

java selenium webdriver selenium-webdriver

34
推荐指数
6
解决办法
15万
查看次数

量角器E2E测试种子数据库

我没有找到一个好方法这样做,所以希望有人有一些想法.在运行E2E量角器测试之前,有没有办法用测试数据为数据库播种?

人们这样做还是他们只是嘲笑后端?为我嘲笑后端不是一个选项,所以会欣赏有关如何种子数据库的想法.有一些解决方案使用节点但没有结论.

对我来说,E2E测试的重点是进入数据库级别

谢谢

integration-testing unit-testing angularjs protractor

10
推荐指数
1
解决办法
5614
查看次数

杰克逊试图将json反序列化为类型对象列表

我试图使用Jackson反序列化对象的属性,该对象是类型化对象的列表.当我尝试这样做时,我得到以下错误

无法[map type; class java.util.HashMap, [simple type, class java.lang.String] -> [simple type, class java.lang.String]]从JSON String 实例化类型的值; 没有单字符串构造函数/工厂方法

到目前为止,我有以下但它似乎没有工作.

Terms.class

@JsonDeserialize(as=JsonMapDeserializer)
private List<ObjectA> results = null;   //ommitted getter and setters
Run Code Online (Sandbox Code Playgroud)

我的Deserializer类如下.

public class JsonMapDeserializer extends JsonDeserializer<List<ObjectA>> {

List<ObjectA> retMap = new ArrayList<ObjectA>();

TypeReference<HashMap<String,String>[]>  typeRef = new TypeReference<HashMap<String,String>[]>() {};

@Override
public List<ObjectA> deserialize(JsonParser parser, DeserializationContext ctx)
        throws IOException, JsonProcessingException {

    ObjectMapper mapper = new ObjectMapper(); 
    //read the json string into the map
    HashMap<String, String>[] maps = mapper.readValue(parser, typeRef); 
    if(maps != …
Run Code Online (Sandbox Code Playgroud)

java json jackson

7
推荐指数
1
解决办法
5009
查看次数

使用HTTPURLConnection提交表单

您好我正在尝试使用HTTPURLConnection作为练习提交以下表单.

<form name="popnames" method="post" action="/cgi-bin/popularnames.cgi" onsubmit="return       submitIt();">
<p>
<label for="year">Birth Year:</label><br>
<input type="text" name="year" size="5" maxlength="4" id="year" value="2011">
</p>
<p>
<label for="rank">Popularity:</label><br>
<select name="top" size="1" id="rank">


<option value="20">Top 20</option>
  <option value="50">Top 50</option>
  <option value="100">Top 100</option>
  <option value="500">Top 500</option>
  <option value="1000">Top 1000</option>
</select>
</p>
<fieldset>
<legend>Name rankings may include:</legend>
<input type="radio" name="number" value="p" id="percent">
<label for="percent">Percent of total births</label><br>
<input type="radio" name="number" value="n" id="number">
<label for="number">Number of births</label>
</fieldset>
<hr>
<input class="uef-btn uef-btn-primary" type="submit" value="  Go  ">
</form>
Run Code Online (Sandbox Code Playgroud)

我使用HTTPURLConnection来提交这是我的代码和我的测试类

public class …
Run Code Online (Sandbox Code Playgroud)

java httpurlconnection

5
推荐指数
1
解决办法
1万
查看次数

spring config server not refreshing properties

I have a spring boot app that uses the config server to load its properties. The properties exist in the src.main/resources/config directory of the config server project.

When I hit the restful endpoint the properties are loaded fine intially then when I change the properties it still displays the old properties value. How do I call the refresh endpoint as when I call the URL? Do I call it on config-service or hello-service? Even though from the logs it looks …

spring spring-boot spring-cloud

5
推荐指数
1
解决办法
3265
查看次数

将多部分文件卷曲到Spring Boot Rest端点

我正在尝试将文件发布到使用Curl在春季启动中实现的宁静端点,并且抛出以下错误:

    $ curl -v http://localhost:8081/qas/uploadCsv -X POST -F "file=@test.csv"
Note: Unnecessary use of -X or --request, POST is already inferred.
* timeout on name lookup is not supported
*   Trying ::1...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to localhost (::1) port 8081 (#0)
> POST /qas/uploadCsv HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.46.0
> Accept: …
Run Code Online (Sandbox Code Playgroud)

rest spring curl spring-boot

5
推荐指数
1
解决办法
1841
查看次数

Spring Boot配置属性不起作用

这让我在努力让 spring boot @configurationproperties 注释工作起来。所以希望有人能为我阐明我做错了什么。我有一个 Spring Boot 应用程序,它在类路径上包含一个 application.properties 。它的价值在于

server.contextPath=/test/v1
server.port=8080

spring.profiles.active=dev
vendors=me
Run Code Online (Sandbox Code Playgroud)

我有一个 application.class ,它具有 spring boot 注释,位于包层次结构的顶部

package com.test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@EnableConfigurationProperties
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试将属性供应商映射到配置属性 bean 中,如下所示

package com.test.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Component
@PropertySource("classpath:application.properties")
@ConfigurationProperties
public class GlobalProperties {

    private String vendors;

    public String getVendors() {
        return vendors;
    }

    public void setVendors(String vendors) {
        this.vendors = vendors;
    }
} …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc spring-boot

5
推荐指数
1
解决办法
3万
查看次数

spring boot app只接受6个请求为什么?

这真让我烦恼,并希望有人可以提供帮助.

我有一个弹簧启动应用程序,我正在向邮递员发送请求,我需要同时触发大约20个单独的请求.但是我的应用程序只接受6,然后当这些已完成时启动其他应用程序.

我把这个例子麻痹了,以便在这里发布

简单的控制器方法

@RequestMapping(value = "/testPost", method = RequestMethod.POST)
    public @ResponseBody String handleFileUpload() throws InterruptedException {
        System.out.println("Recieved request for Thread sleeping" + Thread.currentThread().getName());
        Thread.sleep(40000);
        System.out.println("Recieved request for Thread waking" + Thread.currentThread().getName());
        return "returning from post";
    }
Run Code Online (Sandbox Code Playgroud)

application.properties:我将最大线程数改为200而不是默认,但没有区别

server.contextPath=/qas
server.port=8081

server.tomcat.max-threads=200
Run Code Online (Sandbox Code Playgroud)

记录邮递员发出的请求.正如您在6个请求后看到的那样,第7个请求仅在第1个请求空闲后才能得到服务.我在我的本地桌面上运行没有负载均衡器这是什么原因?不确定为什么它会在6点停止?

日志:

2016-04-08 09:02:35.408  INFO 17700 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/qas]    : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-04-08 09:02:35.408  INFO 17700 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2016-04-08 09:02:35.421  INFO 17700 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in …
Run Code Online (Sandbox Code Playgroud)

spring multithreading spring-boot postman

2
推荐指数
1
解决办法
1201
查看次数