multiple ExecuteScriptAsync

184 views
Skip to first unread message

ziburudebian

unread,
Mar 22, 2017, 11:42:34 AM3/22/17
to CefSharp
hi

i want apply multiple ExecuteScriptAsync on my ChromiumWebBrowser

after the first ExecuteScriptAsync, i have the good result, but when i run another ExecuteScriptAsync, the browser do not change

how can i retreive the ChromiumWebBrowser context to apply my second ExecuteScriptAsync

thanks

i'm using the cefsharp offscreen sample; in MainAsync function i have add this :

....................
await
LoadPageAsync(browser);

// Click on radio button
string code_javascript = @"document.getElementById('ctl0_CONTENU_PAGE_EntrepriseFormulaireDemande_choixAnonyme').click();";
browser
.ExecuteScriptAsync(code_javascript);

// click on validate button
code_javascript
= @"document.getElementById('ctl0_CONTENU_PAGE_validateButton').click();";
browser
.ExecuteScriptAsync(code_javascript);
               
await browser
.GetSourceAsync().ContinueWith(taskHtml =>
{
string html = taskHtml.Result;
string namefile = ".\test.publics_test.html";
StreamWriter monStreamWriter = new StreamWriter(namefile);
// write html in a file
monStreamWriter
.WriteLine(html);
monStreamWriter
.Close();
});
....................

Reply all
Reply to author
Forward
0 new messages