清除日期输入在chromewebdriver上失败 [英] Clear date input fails on chromewebdriver

查看:268
本文介绍了清除日期输入在chromewebdriver上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b $

我在遇到问题时,从firefoxdriver转换到chromedriver与硒,它在FF工作正常,但现在当我尝试清除日期输入字段我有这个错误: b

 导致:org.openqa.selenium.InvalidElementStateException:元素必须是用户可编辑的
才能清除它。 (警告:服务器没有提供任何堆栈跟踪信息)
命令持续时间或超时:38毫秒
构建信息:版本:'2.31.0',修订版本:'1bd294d185a80fa4206dfeab80ba773c04ac33c0',
时间: '2013-02-27 13:51:26'
系统信息:os.name:'Mac OS X',os.arch:'x86_64',os.version:'10 .8.2',java.version :
'1.6.0_41'
会话ID:cb5a1b7e5f4abc4f2e56e2fe284a9dc3
驱动程序信息:org.openqa.selenium.chrome.ChromeDriver
功能[{platform = MAC,chrome.chromedriverVersion = 26.0 .1383.0,acceptSslCerts = false,
javascriptEnabled = true,browserName = chrome,可旋转= false,locationContextEnabled = false,
version = 25.0.1364.160,cssSelectorsEnabled = true,databaseEnabled = false,
handlesAlerts = true,browserConnectionEnabled = false,nativeEvents = true,
webStorageEnabled = true,applicationCacheEnabled = false,TakingScreenshot = true}]
blah blah ...
pre>

我尝试添加contenteditable属性到我的输入字段,但没有运气:

 < input type =datecontenteditable =truerequired =必需占位符=YYYY-MM-dd/> 

我不知道我是否应该报告或报告哪里,但我发现这些问题在相关有些类似的项目:



https:/ /github.com/jnicklas/capybara/issues/554



https://github.com/Behat/MinkSelenium2Driver/pull/29



同时有任何建议那个错误?



任何

解决方案

作为解决方法,您可以选择表示输入字段的webElement并执行



webElement.SendKeys(Keys.Delete);



以清除该字段。


I ran into a problem while switching from firefoxdriver to chromedriver with selenium, it was working fine in FF but now when I try to clear a date input field I have this error:

Caused by: org.openqa.selenium.InvalidElementStateException: Element must be user-editable
in order to clear it. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '2.31.0', revision: '1bd294d185a80fa4206dfeab80ba773c04ac33c0',
time: '2013-02-27 13:51:26'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.2', java.version: 
'1.6.0_41'
Session ID: cb5a1b7e5f4abc4f2e56e2fe284a9dc3
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=MAC, chrome.chromedriverVersion=26.0.1383.0, acceptSslCerts=false,
javascriptEnabled=true, browserName=chrome, rotatable=false, locationContextEnabled=false,
version=25.0.1364.160, cssSelectorsEnabled=true, databaseEnabled=false, 
handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true,
webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]
blah blah...

I tried adding the contenteditable attribute to my input fields but no luck there:

  <input type="date" contenteditable="true" required="required" placeholder="YYYY-MM-dd" />

I am not sure if I should report that or where to report it but I found these issues in related projects that somewhat similar:

https://github.com/jnicklas/capybara/issues/554

https://github.com/Behat/MinkSelenium2Driver/pull/29

In the meantime any suggestions to get around that bug?

Ren

解决方案

As a workaround you can select the webElement representing the input field and perform a

webElement.SendKeys(Keys.Delete);

to clear the field.

这篇关于清除日期输入在chromewebdriver上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆