How to access html elements with CEFSharp?

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

How to access html elements with CEFSharp?

Postby hakancaliskan » Fri Sep 17, 2021 6:33 am

<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 ?
hakancaliskan
Newbie
 
Posts: 1
Joined: Fri Sep 17, 2021 6:12 am

Re: How to access html elements with CEFSharp?

Postby amaitland » Fri Sep 17, 2021 2:20 pm

You can use JavaScript to interact with the DOM.

https://github.com/cefsharp/CefSharp/wi ... ntegration
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am


Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 3 guests