|
Rank: Member Groups: Member
Joined: 9/3/2015 Posts: 19
|
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.aspxhttps://www.essentialobjects.com/Forum/postsm36936_LoadCompleted-event-problem.aspxSteps 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
|
|
Rank: Member Groups: Member
Joined: 9/3/2015 Posts: 19
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
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!
|
|
Rank: Member Groups: Member
Joined: 9/3/2015 Posts: 19
|
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?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
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!
|
|
Rank: Member Groups: Member
Joined: 9/3/2015 Posts: 19
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Great. Thanks for confirming the fix!
|
|