如何从禁用文本框中获取文本

时间:2015-04-02 11:33:21

标签: selenium selenium-webdriver

<i> 
  <input id="date-day" class="myclass" type="text"
    value="" readonly="readonly" placeholder="DD"
    name="EarliestLiveDateDD" maxlength="2"
    data-val-required="The Earliest Delivery date: field is required."
    data-val-number="The field Earliest Delivery date: must be a number."
    data-val="true"/>
  ,
</i>

显示的文本框值为22

尝试使用get text并获取Attribute但无法获取文本。

1 个答案:

答案 0 :(得分:0)

driver.FindElement(By.Id("date-day")).GetAttribute("value");