1

im trying to fill a text box using dotnetbrowser,

this is the element source,

<input class="p-input__ctrl" placeholder="Amount" onchange="changeAmount('Form', this.value, {&quot;NT&quot;:0}, {&quot;4737057&quot;:{&quot;currency&quot;:&quot;EUR&quot;,&quot;platform&quot;:&quot;mt4_real&quot;,&quot;a_id&quot;:4737057,&quot;type&quot;:&quot;cent&quot;,&quot;reg_date&quot;:&quot;07.08.2017&quot;,&quot;balance&quot;:0,&quot;currency_symbol&quot;:&quot;\u20ac&amp;thinsp;&quot;,&quot;server_account_number&quot;:800086,&quot;show_express_field&quot;:false,&quot;has_bonus_60&quot;:false,&quot;fix_rate&quot;:false,&quot;exchangeRate&quot;:{&quot;NT&quot;:{&quot;USD&quot;:0.85,&quot;EUR&quot;:1}},&quot;exchangeRateBack&quot;:{&quot;NT&quot;:{&quot;USD&quot;:1.1765,&quot;EUR&quot;:1}}}}, {&quot;NT&quot;:{&quot;exchangeRate&quot;:[]}}, {&quot;NT&quot;:null}, 'taking into account the payment system commission= ');" name="amount" id="Form_amount" type="text" maxlength="12">

my Code is :

DOMDocument Doc = Browser.GetDocument();
Doc.GetElementById("Form_amount").SetAttribute("value", "1");

nothing happens it doesn't add 1 to the input.

Néoxyne
  • 53
  • 1
  • 8
  • they're `getElementById` and `setAttribute` – qcam Aug 13 '17 at 16:29
  • its DotNetBrowser i used the same code to fill other inputs and it worked well, but just for this one – Néoxyne Aug 13 '17 at 16:31
  • i mean i can compile there's no errors but , when i press the button to execute this code nothing happens even tho the page is loaded – Néoxyne Aug 13 '17 at 16:33
  • I think perhaps you can try `El.value = "1"` (I'm not sure about the API in DonNetBrowser) instead of `El.setAttribute` – qcam Aug 13 '17 at 16:35

1 Answers1

2

Can you try this code:

DOMDocument Doc = Browser.GetDocument();    
DOMInputElement txtAmt = (DOMInputElement)Doc.GetElementByName("amount");
txtAmt.Value = "John";

Source : dotnetbrowser docs

Ankit
  • 5,733
  • 2
  • 22
  • 23