Silktest: Handling dynamic values in a html page

Many of us have faced situations where we are confused in how to handle dynamic values in a HTML page. Some scenarios we are faced are in stock markets – where the shares keep going up and down, invoice generation where for each transaction a new invoice keeps getting generated.

Over here we cannot just give window.HTMLText.getText().
I would be showing a simple way in which you can parse the file for a particular string and then search for the string.

Steps:

1) copy the file using typekeys(ctrl-a,ctrl-c)
2) now using IsClipboard = clipboard.getText() get the file contents into a string. Remember to declare the IsClipboard as list of string.
3) Fro ex. the string name is fileString.
4) You want a dynamic value invoice in the page.
5) Use strpos to find the position of a fixed variable in the fileString variable.
6) After you get the position of a fixed variable use substr to extract the data you need.
7) you can apply this data to get the text what you want like window.htmltext({str}).getText()

This is a simple way of handling the dynamic values in a html page.

Leave a Reply

Your email address will not be published. Required fields are marked *