设置输入文本框文本,然后在Specflow&中检索它.硒 [英] Setting input textbox text and then retrieving it in Specflow & Selenium
本文介绍了设置输入文本框文本,然后在Specflow&中检索它.硒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以向我解释为什么在以下.Net Specflow代码中,如果我的textboxElement的文本为空,那么我向其发送密钥,为什么文本仍然为空? (当屏幕上的文本框的文本更改时):
Could someone explain to me why in the following .Net Specflow code if my textboxElement's text is empty, then I send keys to it, why is text still empty? (when on screen the textbox's text changes):
textboxElement.SendKeys("John Smith");
var text = textboxElement.Text;
// text == ""
是否不可能刷新"元素的值? (或者我只是错过了一些非常明显的东西:-))
Is it not possible to "refresh" the value of an element? (or have I just missed something really obvious :-))
推荐答案
由于它是input
元素,因此需要获取它的value
属性,而不是它的text
.
Since it's an input
element, you'll need to get it's value
property as opposed to it's text
.
所以:
textBoxElement.GetAttribute("value");
这篇关于设置输入文本框文本,然后在Specflow&中检索它.硒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文