|
Rank: Advanced Member Groups: Member
Joined: 5/10/2021 Posts: 43
|
Hello good morning, I am having a problem with a webview, I have developed a Script that allows me to access the elements of a product catalog of a website.
I'm trying to simulate a click to go to the next page within the same function in a webview, and I managed to create a loop that works fine, but when I try to click it doesn't update the webview until it finishes and exits the function that applies to that webview and gives an error that does not recognize an Evalscript that changes or modifies that same Webview, so the development solved it by clicking on the next page outside.
that is, create a loop with an example
for i = 1 to xxx
JS_Download_Data = "xxxxx
my functions
xxxxx
me.webview1.Evalscript(JS_Download_Data)
next
but it is not the best way the idea is to make that click and change the page in the same function with a Witch or For bubble in the JavaScript, otherwise I will need an update with the solution of this error, or unless you give me one idea how to solve this idea better, thank you very much in advance.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
You would have to do it this way. This is because many tasks in the browser engine won't have a chance to run until your code exits. So the basic flow is:
1. You request the browser to do something; 2. The browser engine does the work; 3. You check the result;
Step 1 and step 3 CAN NOT be together in your case. This is like a conversation between two persons. You have to yield so that the other person can respond.
Note that this rule is not absolute and only SOME tasks requires you to relinquish control first. Loading a page is one of them. So you must relinquish control after you initiate the action (clicking next page) in order for the action to be fully carried out.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 5/10/2021 Posts: 43
|
It is clearer to me, in short, if I work with 2 browsers where 1 makes the request, the 2nd works the browser engine and downloads the data and the 1st clicks again on the next page and so on, I would not have problems with this conflict?
Since I'm working with the function extensions and so far it works very well and stable, I'm going to try it this way so that how it works for me and if I have any questions, I'll let you know, since there are some details that I'm still learning.
Thank you very much.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
It doesn't matter how many WebView object you use. If you have a single UI thread, then that UI thread must yield in order for certain task for any WebView to proceed.
Thanks!
|
|