Welcome Guest Search | Active Topics | Sign In | Register

Cannot run javascript on run time Options
Soros
Posted: Saturday, October 29, 2016 12:32:42 AM
Rank: Newbie
Groups: Member

Joined: 10/28/2016
Posts: 5
I am using webview to load a url, after loaded, it has some html element, are generated or value are assign during run time or after document has finished loaded. And I couldn't get the element value at run time...

Because i need to use javascript to run some javascript function which function already defined in the website.

But i noticed that cannot be done using EvalScipt.

Eg.
NavigationTask nv = null;

nv = eoWebControl.WebView.LoadUrl(url);
nv.WebView.LoadCompleted += WebView_LoadCompleted;

webReq = new Request(url);


void WebView_LoadCompleted(object sender, LoadCompletedEventArgs e)
{
if (e.Task.IsDone())
{
MessageBox.Show("load completed: " + e.Url.ToString());
}
}

private void btnGetEle_Click(object sender, EventArgs e)
{
string getEleJs = @"document.getElementById('myframe').contentDocument.embeds[0];";

object obj = eoWebView.EvalScript(getEleJs); // this return EO.WebBrowser.JSUndefined
}


the html document look as follow

<html>
<head>
<title></title>
</head>

<body>
<frameset>
<frameset>
<frame id="myframe">
<body>
<div>
<object>
<param ..... />
<param ..... />
<param ..... />
<param ..... />
<embed src="" />
</object>
</div>
</body>
</frame>
</frameset>
</frameset>
</body>
</html>
eo_support
Posted: Saturday, October 29, 2016 9:17:25 AM
Rank: Administration
Groups: Administration

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

You can try to run the same code in Google Chrome's DevTools console window, do you get a valid value?

Thanks!
Soros
Posted: Monday, October 31, 2016 4:59:13 AM
Rank: Newbie
Groups: Member

Joined: 10/28/2016
Posts: 5
Yes, I can get it from google chrome inspect element console windows. But cannot get from the code i mentioned.
eo_support
Posted: Monday, October 31, 2016 9:10:26 AM
Rank: Administration
Groups: Administration

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

In that case please try to isolate the problem into a test project and send the test project to us:

https://www.essentialobjects.com/forum/test_project.aspx

Once we have that we will be happy to investigate further.

Thanks!
eo_support
Posted: Monday, October 31, 2016 12:38:26 PM
Rank: Administration
Groups: Administration

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

We have received your test project however the Url in your test project displays the following message "Viewing and using this website at your current location is prohibited due to its regulatory rules". Obviously this is not the intended result. As such you may want to host a duplicate copy of the test page in a separate test application and remove such restrictions for your test application.

Thanks!
Soros
Posted: Tuesday, November 1, 2016 7:09:20 AM
Rank: Newbie
Groups: Member

Joined: 10/28/2016
Posts: 5
do you have vpn?? try to use malaysia server vpn.. tq
eo_support
Posted: Tuesday, November 1, 2016 8:41:32 AM
Rank: Administration
Groups: Administration

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

Please try to construct a test HTML file that demonstrates the problem and send us the test file.

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.