How to insert string c# in Cefsharp script

Asked

Viewed 43 times

0

How can I insert a string c# in the script?

string teste = "testando";

chromeBrowser.ExecuteScriptAsync("$(document).ready(function() {alert({0})}); ", teste); 

I tried this code but did not return anything

1 answer

0


The script you are trying to execute is in the syntax of jquery, probably the page will not recognize this naturally, so I suggest you write pure javascript for this, an example would be to do so:

script = "document.addEventListener('DOMContentLoaded', function(){ alert('qualquer coisa'); });";

Still, if you want to use jquery, I suggest following the code of this link.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.