Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

LoadCompleted not triggering on 18.2.53.0 Options
ChiYuen
Posted: Wednesday, August 8, 2018 6:08:40 PM
Rank: Member
Groups: Member

Joined: 9/3/2015
Posts: 10
I am upgrading EO.WebBrowser from 2017(17.1.65.0) to 2018(latest 18.2.53.0) however the latest version is failing my original program logic.

The LoadCompleted event is not firing on sub-sequence requests after first "LoadUrl".

I see a similar issue on older builds:
https://www.essentialobjects.com/forum/postst9751_EO-Webbrowser-form-submit-and-wait.aspx
https://www.essentialobjects.com/Forum/postsm36936_LoadCompleted-event-problem.aspx

Steps to reproduce:

1. Use 18.2.53.0 to make a simple webbrowser.
2. Register WebView.LoadCompleted handler to write log when triggered
3. WebView.LoadRequest("http://www.example.com")
4. LoadCompleted triggered when finished loading the page
5. Click any link on the page to make it navigate to another page
6. LoadCompleted not triggering any more.


EDIT:
just did some testing, the feature in 18.0.70 is working, and broken in 18.0.98
ChiYuen
Posted: Wednesday, August 8, 2018 6:15:34 PM
Rank: Member
Groups: Member

Joined: 9/3/2015
Posts: 10
Besides this question, there is another program with getting the page HTML.

I need to capture users' navigation event and prevent them from going to some url, I use "BeforeNavigate" for this.

In the 2018(latest 18.2.53.0) build, when I stop a request in "BeforeNavigate" by setting "e.Cancel = True", the "WebView.GetHtml" method takes a long time(hanging) to response and returns empty content.

In old builds (17.1.65.0), the said logic is working and the GetHtml returns the page source of the current showing page.
eo_support
Posted: Thursday, August 9, 2018 3:51:45 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,821
Hi,

We have looked into both issues. Here are our findings:

1. LoadCompleted event is in fact fired correctly. However the Url property of the event argument is not properly populated (is always null). This may have led to the wrong conclusion that the event has not been fired at all. The real issue is e.Url should not be empty. We will fix this in our next build;

2. Calling GetHtml from inside BeforeNavigate is not supported. It might have worked "accidentally" in early builds but it's not supposed to work. The root of the problem is BeforeNavigate is triggered by Chromium's render process's main thread and it's a blocking call. This means the render's main thread will wait until it hears an answer from your code about whether to proceed or not. While it is waiting for you, it can not do anything else that are also done in the render's main thread. These would include but not limiting to tasks such as evaluate JavaScript code, making changes to the DOM tree, or retrieving the HTML/source of the document. This is why GetHtml would hang in this case. We have some safe guard mechanism in place for such scenarios. For example, if you were to call WebView.EvalScript inside BeforeNavigate, you would get an exception stating this is not allowed. GetHtml should have perform the same check as well. As such you must change your design not to rely on anything that you will need at this last minutes to decide whether to proceed or not;

Hope this helps. Please feel free to let us know if you still have any questions.

Thanks!

ChiYuen
Posted: Friday, August 10, 2018 11:49:09 AM
Rank: Member
Groups: Member

Joined: 9/3/2015
Posts: 10
Hello, thanks for the reply.

1. I re-tested and can confirm the same. Please have it fixed asap as this is an important event for web-automatons.

2. Any method I can "GetHtml" of current showing page after I stopped a navigation in BeforeNavigate(or BeforeRequestLoad) ? For example using Form.Invoke/BeginInvoke and call GetHtml from UI thread?
eo_support
Posted: Friday, August 10, 2018 12:31:36 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,821
ChiYuen wrote:
1. I re-tested and can confirm the same. Please have it fixed asap as this is an important event for web-automatons.

Yes. We will fix it ASAP and reply here again once the new build is out.

ChiYuen wrote:
2. Any method I can "GetHtml" of current showing page after I stopped a navigation in BeforeNavigate(or BeforeRequestLoad) ? For example using Form.Invoke/BeginInvoke and call GetHtml from UI thread?


Yes. You should be able to do that.
eo_support
Posted: Thursday, August 23, 2018 10:56:37 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,821
Hi,

This is just to let you know that we have posted a new build that should fix the Url issue. Please download the new build from our download page and let us know how it goes.

Thanks!
ChiYuen
Posted: Thursday, August 23, 2018 12:17:46 PM
Rank: Member
Groups: Member

Joined: 9/3/2015
Posts: 10
eo_support wrote:
Hi,

This is just to let you know that we have posted a new build that should fix the Url issue. Please download the new build from our download page and let us know how it goes.

Thanks!


Tested and confirmed working.
eo_support
Posted: Thursday, August 23, 2018 12:26:16 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,821
Great. Thanks for confirming the fix!


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.