为什么我不能为此元素设置属性?
why i can't Set Attribute to this element?
我正在尝试使用 dotnetbrowser 填充文本框,
这是元素来源,
<input class="p-input__ctrl" placeholder="Amount" onchange="changeAmount('Form', this.value, {"NT":0}, {"4737057":{"currency":"EUR","platform":"mt4_real","a_id":4737057,"type":"cent","reg_date":"07.08.2017","balance":0,"currency_symbol":"\u20ac&thinsp;","server_account_number":800086,"show_express_field":false,"has_bonus_60":false,"fix_rate":false,"exchangeRate":{"NT":{"USD":0.85,"EUR":1}},"exchangeRateBack":{"NT":{"USD":1.1765,"EUR":1}}}}, {"NT":{"exchangeRate":[]}}, {"NT":null}, 'taking into account the payment system commission= ');" name="amount" id="Form_amount" type="text" maxlength="12">
我的代码是:
DOMDocument Doc = Browser.GetDocument();
Doc.GetElementById("Form_amount").SetAttribute("value", "1");
没有任何反应,它没有将输入加 1。
你能试试这个代码吗:
DOMDocument Doc = Browser.GetDocument();
DOMInputElement txtAmt = (DOMInputElement)Doc.GetElementByName("amount");
txtAmt.Value = "John";
来源:网络浏览器 docs
我正在尝试使用 dotnetbrowser 填充文本框,
这是元素来源,
<input class="p-input__ctrl" placeholder="Amount" onchange="changeAmount('Form', this.value, {"NT":0}, {"4737057":{"currency":"EUR","platform":"mt4_real","a_id":4737057,"type":"cent","reg_date":"07.08.2017","balance":0,"currency_symbol":"\u20ac&thinsp;","server_account_number":800086,"show_express_field":false,"has_bonus_60":false,"fix_rate":false,"exchangeRate":{"NT":{"USD":0.85,"EUR":1}},"exchangeRateBack":{"NT":{"USD":1.1765,"EUR":1}}}}, {"NT":{"exchangeRate":[]}}, {"NT":null}, 'taking into account the payment system commission= ');" name="amount" id="Form_amount" type="text" maxlength="12">
我的代码是:
DOMDocument Doc = Browser.GetDocument();
Doc.GetElementById("Form_amount").SetAttribute("value", "1");
没有任何反应,它没有将输入加 1。
你能试试这个代码吗:
DOMDocument Doc = Browser.GetDocument();
DOMInputElement txtAmt = (DOMInputElement)Doc.GetElementByName("amount");
txtAmt.Value = "John";
来源:网络浏览器 docs