Welcome Guest Search | Active Topics | Sign In | Register

webView1.EvalScript is not Synchronously? Options
lsl
Posted: Sunday, March 20, 2016 4:07:31 AM
Rank: Member
Groups: Member

Joined: 1/14/2016
Posts: 28
on our document webView1.EvalScript will Executing JavaScript Synchronously

but in my test

for(int i = 0; i < 999;i++)
{
jsret = (string)webViewMain.EvalScript(
"document.getElementById('xxxx"').parentElement.parentElement.parentElement.parentElement.children[1].children[0].children[1].innerText");

// I must add next code, other way it will throw exception , so if EvalScript is Synchronously why should we do this
while (!webViewMain.CanEvalScript)
{
Thread.Sleep(200);
}

jsret = (string)webViewMain.EvalScript(
"document.getElementsByClassName('total')[0].innerText");
}
eo_support
Posted: Sunday, March 20, 2016 4:54:11 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

Please replace your Thread.Sleep with this method and see if it works:

http://www.essentialobjects.com/doc/eo.webbrowser.webview.doevents_overload_2.aspx

Thanks!
lsl
Posted: Sunday, March 20, 2016 8:44:15 PM
Rank: Member
Groups: Member

Joined: 1/14/2016
Posts: 28
eo_support wrote:
Hi,

Please replace your Thread.Sleep with this method and see if it works:

http://www.essentialobjects.com/doc/eo.webbrowser.webview.doevents_overload_2.aspx

Thanks!


Code: C#
while (!webViewMain.CanEvalScript)
{
Thread.Sleep(200);
}

why I add above code is because evalscript throw exception


since EvalScript is Synchronously It should not throw exception
eo_support
Posted: Monday, March 21, 2016 8:25:31 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You can create a test project and send it to us. Once we have that we will investigate further.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.