Page 1 of 1

How to access html elements with CEFSharp?

PostPosted: Fri Sep 17, 2021 6:33 am
by hakancaliskan
<form action="" class="" id="loginForm" method="post" autocomplete="off">
<div class="phone-wrap-click mobile-change" data-bind="css: { hide: isMembership() }">
<div class="form-group">
<label class="control-label" data-bind="i18n: { html: 'auth_title_phone_number_email' }">Cep telefonu ya da e-posta adresi</label>
<input name="PhoneMail" data-bind="value: PhoneMail" autocomplete="off" class="form-control text-left phone-code PhoneMail" type="text"><span class="validationMessage" style="display: none;"></span>
</div>
</div>
</form>


in the html page above
I want to print something I want in the text box named "PhoneMail" using cefsharp. Just like I did below using webBrowser1


foreach (HtmlElement elmnt in webBrowser1.Document.GetElementsByTagName("input"))
{
if (elmnt.GetAttribute("name") == "PhoneMail")
{
elmnt.InnerText = "hakanxcaliskan";
//Thread.Sleep(50);
SendKeys.Send("{ENTER}");
//Thread.Sleep(100);
}


how can I do that ?

Re: How to access html elements with CEFSharp?

PostPosted: Fri Sep 17, 2021 2:20 pm
by amaitland
You can use JavaScript to interact with the DOM.

https://github.com/cefsharp/CefSharp/wi ... ntegration