Can you find input from a page?

wheretheidivides

Active Member
Licensed User
Longtime User
SO let's say I go to a web page. On it they have fields to click on and fields to write stuff on. Is there a way to have a B4A program find this out?

For example, let's use something you all know. Let's say you have a program on google play store. If you know the link, can you have B4A
1) go the link
2) download it
3) rate it
4) comment it
5) uninstall program.

Basically, how would you find the rate it area and rate the program 5 stars? and how would you find the comment section and comment on it?? Not that I want to do this, but it was a easy analogy.
 

warwound

Expert
Licensed User
Longtime User
You need to research javascript, how it can be injected into a webpage after the webpage has loaded and how that javascript can simulate user actions on in the webpage.

If you find that javascript can do as you require then you can use the WebViewExtras library to execute javascript in the (loaded) webpage or you can execute javascript without WebViewExtras by using this syntax:

B4X:
Dim MyJavascriptCommand As String
MyJavascriptCommand=""
MyWebView.LoadUrl("javascript:"&MyJavascriptCommand)

Creating the required javascript involves looking at the webpage source code (HTML) and identifying which HTML elements you can get a reference to and how you might be able to manipulate those elements.

You could take a while to analyse the webpage for an app on the Play Store and find a way to inject javascript to do as you require - but if Play Store then change their webpage layout you will likely find your javascript code no longer works.

If you have a webpage that you have created yourself and have complete control over then you can inject javascript into that webpage and be confident that the javascript will always work.

A goog starting point would be find out what javascript is capable of and then find out if you can use the javascript commands you want to use in the webpage you want to interact with.

JavaScript and HTML DOM Reference

Martin.
 
Upvote 0
Top