How do I scrape data from Web?

I am not good and best in js please help me master, I tried with

window.AppInventor.setWebViewString(document.querySelectorAll('span.compare')[0].innerHTML)

It is not working.

The query looks OK:

image

This is working for me:

window.AppInventor.setWebViewString(document.querySelectorAll('span.compare')[0].innerHTML)

I have only one webview can I run multiple request at same time, but how to identify the particular request in it?

Add a marker / id to the setWebViewString command.

In which place and how?

I am using this method to identify my javascript.

this is not returning value on the first click,but giving value on second click instantly.

Guide me where I am Wrong Matser @TIMAI2

You could do this, which returns a stringified json:

window.AppInventor.setWebViewString('{"compare": "' + document.querySelectorAll('span.compare')[0].innerHTML + '"}')

{"compare": 'Rs. 1,299.00"}

1 Like

You could also make several calls in one go:

window.AppInventor.setWebViewString('[{"current": "' + document.querySelectorAll('span.current')[0].innerHTML + '"}'+ ',' + '{"compare": "' + document.querySelectorAll('span.compare')[0].innerHTML + '"}]')

[{"current": "Rs. 699.00"},{"compare": "Rs. 1,299.00"}]

What is the meaning of WebViewString and why and what is the usage of this in Webview?

As of now I read, it is basically to connect Website using javascript to the app with webviewstring property...

Help me Master Tim.

I am confused, if when my clock do, the evaluate js not working,
but for the MRP Label it is working, I experiment it by placing a notifier in the block, the MRP label clock and blocks are working But I can't be able to get the value of PriceLabel to the label.



This is my full webview string block :

Looked a mess even before you drew all over it :wink:

Explain in words the workflow, it is difficult to see, even from your blocks, what you are hoping to achieve.

  1. I do Evaluate webString to get image from the website in the webview.

  2. In the same webview i ran another JS which was for MRP (span.compare)

  3. Same webview ran another JS to get the Discounted amount Price(span.current)

  4. In all JS evaluation i put some seconds of time to not get bulky the server.

  5. The first clock to get images is working fine and second to get MRP(span.compare) is also working fine but the third clock for Price(span.current) is not starting infact same starting as after the image got and MRP clock.

Why not just return the whole lot in one call, as I suggested above...

How to distinguish between them?(i know about this.)

But problem solving my mind ask me to solve this bug and improve it as it is with one by one as this help me to execute multiple JS in one webview and also helps me to idetify each Execution by Javascript variable. :smile: This is for my learning approach

Why make 3/4/5 calls, with added complications, when you can make one ?

The payload is not very big at all, probably no more than 200 characters.

Give me structural help, how to fix these issue?, in one post

See three posts up

But this don't let me know and to explore how to use Evaluate JS and how to identify the JS evaluated, in When WebView.WebViewStringChanged(value), as this does not have id and I cannot identify any one of the JS Evaluated if all JS evaluated at very same time.