Home > OS >  Write values to text boxes on web page with CefSharp
Write values to text boxes on web page with CefSharp

Time:12-09

I integrated CefSharp into my project. I was able to work out some points. However, I couldn't figure out how to check Inputboxes for example on a given site. So how can I write data into that InputBox. I request your help in this matter. Thanks in advance.

CodePudding user response:

You won't be able to modify the content of your web page running inside CefSharp from the C# code directly. What you can do however is to pass javascript code that will run on the page and will change content.

For example, something similar to this:

var browser = new ChromiumWebBrowser("https://www.example.com");
await browser.ExecuteScriptAsync("document.getElementById('myTextBoxId').value='the value'");

CodePudding user response:

What I want to do is actually as you show. Can you show me on an example like this? Example: google.com. Type a value in the search box and then press the search button. Thanks.

  • Related