Recent

Author Topic: How to acces html elements on web page from stand alone application?  (Read 10840 times)

BeniBela

  • Hero Member
  • *****
  • Posts: 906
    • homepage
Re: How to acces html elements on web page from stand alone application?
« Reply #15 on: July 30, 2016, 12:38:56 pm »
Where else can samples you have already provided be found? (I hate to use your time with my questions, if there are other resources to learn from)

I do not actually use it one that level, with map and retrieve.

I put the entire program in that string and call query once to get the result without doing any calculation in Pascal. (or skip even query and use the underlying classes directly, with XML-files containing multiple XQuery statements: https://sourceforge.net/p/videlibri/code/ci/tip/tree/programs/internet/xidel/examples/ or template file in https://sourceforge.net/p/videlibri/code/ci/tip/tree/programs/internet/VideLibri/data/libraries/templates/summon/  )
 
Since it is  XQuery compatible, you can use any example they have in the (wiki)books.  (The extension functions are not the same, but every standard function (that has no prefix or the fn:prefix there) are the same)

One reason to make it XQuery-compatible is that so I do not have to write documentation. Just remember that x.map('query') corresponds to the XQuery expression x ! query and x.filter('query') to x [ query ]

Only .retrieve is special

It turned out, I have never actually submitted the form, the mapped fields and values became parameters of the URL of a get command.
So the next task is to figure out how to "push" this button:

<button id="submitLogin" type="submit" class="btn mag" tabindex="3">Log in</button>

You do not actually "push" it.

You sent an HTTP request that is the same as the one the browser would make. .map creates the request and .retrieve sends it.

Some pages want the name of the pressed button as additional parameter (they have multiple buttons each doing something else),  but your button does not seem to have a name or value

CC

  • Full Member
  • ***
  • Posts: 149
Re: How to acces html elements on web page from stand alone application?
« Reply #16 on: July 31, 2016, 02:03:06 am »
I will check the links you have provided , thanks a lot.

Looking at the massage flow with Fiddler retrieve() always generated GET messages.

If I log in manually with the browser it sends a POST message submitting the login form with many fields, even the ones with no value assigned by the user ( can be empty or have a default value). I can see that sending a POST message is possible with  internet-tools, but can it create such POST message based on the input elements on the form plus some supplied  field-value mappings? (I assume no but since it is a simple yes or no question I rather ask than reinvent the wheel)
« Last Edit: July 31, 2016, 09:26:19 pm by CC »

BeniBela

  • Hero Member
  • *****
  • Posts: 906
    • homepage
Re: How to acces html elements on web page from stand alone application?
« Reply #17 on: July 31, 2016, 06:50:54 pm »
That depends on the value returned by map.

It uses temporary json objects for that e.g. { "url": "http://..:", "method": "POST", "post": "a=b&c=d" }

The form function checks if there is a method attribute on the form element. If it ismethod="post", it returns an object with post, if it is get, it returns a get url.
That is supposed to match the browser behaviour

« Last Edit: July 31, 2016, 06:55:08 pm by BeniBela »

 

TinyPortal © 2005-2018