屏蔽文本框问题
我正在使用电话字段的 rad masked 控件。
telerik:RadMaskedTextBox ID="txtPhone1" runat="server" EnableAjaxSkinRendering="False" Mask="(###) ###-####" Skin="Hay" ZeroPadNumericRanges="False" MaxLength="20" TabIndex="30" Width="200px"></telerik:RadMaskedTextBox
当我尝试使用 watir 添加电话时,使用此代码
browser.text_field(:id => 'ctl00_ContentPlaceHolder1_Registration2_txtPhone1_text').set '7893457889'
仅添加了最后一个值。请帮助我。如何填充掩码值。
i m using the rad masked control for phone field.
telerik:RadMaskedTextBox ID="txtPhone1" runat="server" EnableAjaxSkinRendering="False" Mask="(###) ###-####" Skin="Hay" ZeroPadNumericRanges="False" MaxLength="20" TabIndex="30" Width="200px"></telerik:RadMaskedTextBox
when i m trying to add phone using watir, using this code
browser.text_field(:id => 'ctl00_ContentPlaceHolder1_Registration2_txtPhone1_text').set '7893457889'
only last value has been added. kindly help me out. how to fill masked value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Watir-webdriver 和 Teleriks 演示站点 和 IE 浏览器,我能够使用 设置值
这似乎按预期工作,添加了格式,并且对我来说似乎有用。
有了 Watir,我可以通过使用来设置它,
但是尽管该值显示在字段中,但它没有格式化,我永远无法让它实际验证该输入。我尝试触发各种事件,例如 onchange,让客户端代码来处理它,但没有任何乐趣。如果我正在使用此工具,我可能会考虑致电供应商或访问他们的网站并向他们寻求帮助。 (假设您需要使用 Watir)
如果 watir-webdriver 对您来说不是一个可行的选择(我喜欢它用于跨浏览器测试)那么也许其他人可以花时间深入挖掘。 (我个人已经过了这样的阶段:深入研究这个控件来扩展我自己的知识值得我的雇主花时间......)
可能有一些方法可以通过 Rautomation 解决这个问题,但我对它足够新了,我不知道'我不会立即看到一个简单的解决方案。
Using Watir-webdriver and the example from Teleriks demo site, and IE browser, I was able to set the value with
This seemed to work just as expected, added the formatting, and seemed functional to me.
With Watir I was able to set it via using
However although the value showed up in the field, it was not formatted and I was never able to get it to actually validate that input. I tried firing various events such as onchange, to get the client side code to process it, but no joy. If I was using this tool I might consider calling the vendor or getting on their site and asking them for assistance at this point. (provided you need to use Watir)
If watir-webdriver is not a viable option for you (I like it for cross browser testing) then perhaps someone else can spend the time to dig a bit deeper. (I'm personally past the point where digging into this control to extend my own knowledge is worth my employers time...)
Possibly there might be some way around this with Rautomation, but I'm new enough with it where I don't immediately see an easy solution there.
我的天啊。这已经太老了。但我要补充一下。在处理屏蔽元素时,我成功地使用了以下 sendkeys 技术,而不是将值注入到内部元素文本中。发送 Ctrl-A 突出显示所有内容,然后开始键入,然后按 Tab 键失控。
OMG. This is so old. But I am going to add to it. When dealing with masked elements, I am successful using the following sendkeys technique instead of injecting the value into the inner element text. Send Ctrl-A to highlight everything, then start typing, then tab out of control.