sendKeys()无法使用chromedriver中的有线协议进行日期输入

时间:2015-04-15 05:51:21

标签: java android webdriver selenium-chromedriver

我正在尝试使用ChromeDriver从java执行测试用例并执行json wire协议。到目前为止,我能够轻松地运行我的测试用例,但现在我在输入标签类型日期发送文本时遇到了问题。

我能够在页面上找到该元素。即使使用此sendKeys协议发送文本事件,也会返回成功结果代码0,但在该输入元素上找不到文本字符串。

代码段:

...
JSONObject jsonObject = new JSONObject();
jsonObject.put("value", values.toCharArray());
String json = Util.executeRequest(Util.buildUri(Constants.METHOD_SEND_KEYS, params),
RequestMethod.POST, jsonObject);
JSONObject responseObj = new JSONObject(json);
if(Integer.parseInt(responseObj.get("status").toString()) != 0){
    ExceptionManager.parseException(Integer.parseInt(responseObj.get("status").toString()), new JSONObject(responseObj.get("value").toString()).get("message").toString());
}

Util.executeRequest

...
HttpClient client = HttpClientBuilder.create().build();
HttpPost httpPost = new HttpPost(url);
if(body!=null){
    HttpEntity entity = new StringEntity(body.toString());
    httpPost.setEntity(entity);                     
}
response = client.execute(httpPost);
json = EntityUtils.toString(response.getEntity());

我已尝试使用chromedriver版本2.9,2.14,2.15,但我似乎没有发现版本问题。任何帮助将不胜感激。

0 个答案:

没有答案
相关问题