|
Purpose | With connectHTML you can read values from an HTML page that you have displayed with the View command. You can also change values and perform various actions, such as clicking on a link. Both your own HTML pages and any internet or intranet pages can be used. The display via View can be integrated into the SAP screen or can be a separate “floating” window. For further details please see our documentation “Special Topics”, “Automating internet pages”. | ||||||||||||||||||||
Example | connectHTML click=“button_Continue”
The button “Continue” is clicked in the HTML page that is currently displayed via View. | ||||||||||||||||||||
Format | When there is only one HTML page currently opened via View - which is the standard case – you can use
without specifying window=“…”. All options and HTML variables html[...] then refer to this page. In cases where there are several active View windows, you can specify the desired window explicitly:
Here you use the window number returned by a ”View …. returnwindow=viewwindow” statement. All options and HTML variables then refer to this window. You have to use a connectHTML command only when you either use special options (see below), or you need to specify the window. Otherwise you can immediately use the HTML variables:
| ||||||||||||||||||||
Options |
| ||||||||||||||||||||
Using the HTML elements | The HTML variables can be used in the same way as the usual script variables V[...]. Notation is html[...]. You can use it in following contexts:
After a new value is set, GuiXT automatically invokes the “on change” routine of the HTML page for this element. In the case of drop down fields (Select element) it is necessary in some cases to perform a click on this element after changing it, using click=. Otherwise some of the internal processing in the HTML page might be missing. When you automate the user interaction for an HTML page, the means provided by connectHTML are sufficient in most cases (setting values and clicking on links, buttons or images). However, in other cases, where special JavaScript or VBScript functions are used or there are special plugins in the page, the automation of the user interaction can be beyond the connectHTML capabilities. | ||||||||||||||||||||
How to name the HTML elements | During development we suggest you use the listelements= and -shownames features to display the HTML element names.
GuiXT builds the name of an element in the following way: The name always starts with the element type (image_, button_, checkbox_, …). Next, the internal id or name of the element, or user text (like a button text). All “space” characters are replaced with underline. If duplicate names arise, GuiXT adds a suffix .2, .3,… . Examples: html[image_help.jpg] | ||||||||||||||||||||
HTML Tables | Tables are quite common in HTML pages. They can be nested. GuiXT allows us to address each table cell. For the names, GuiXT uses the following notation: cell_i.j.k is cell number k of row j in table i.
For example, html[cell_1.4.5] denotes a cell within the first table of the page, namely the cell in row 4, column 5 (starting with 1). For nested tables, the name starts with the name of the cell that contains the table, followed by ‘~’ and the normal cell coordinates within the nested table. Example: html[cell_3_1_7~1_2_2~2.2.4] This is the following cell: Start with the third outer table of the page. Choose the cell in row 1, column 7. There is at least one nested table in this cell. Take the first one, and then the cell in row 2, column 2 of this first nested table. In this cell, there are at least 2 more nested tables (nesting level 2). Take the second one, go to row 2 and column 4, and you have reached cell cell_3_1_7~1_2_2~2.2.4. Row count for each table For each table GuiXT allocates an HTML variable “…_rows” that contains the number of rows for this table. For example, “&html[table_1_rows]“ denotes the number of rows of the first table. For nested table, the same rules as described above apply. Example: “&html[table_3_1_7~1_rows]“ This is the number of rows of the first nested table contained in cell row 1 column 7 of the third table on the page. Instead of using the row count, it is often more practical to query the existence of a certain cell. Example: // row index Set V[i] &V[i] + | ||||||||||||||||||||
Checkbox and radiobutton | The values of a checkbox or radiobutton are represented by 0 and 1. When you set a radiobutton all other radiobuttons in the same group are automatically reset. Example:
| ||||||||||||||||||||
Load time of HTML pages | After some actions, e.g. clicking a button, a new HTML page needs to be loaded, which may take some time. Each
connectHTML command first waits until the page is fully loaded before performing the required action. After waiting 2 minutes, connectHTML returns to script processing. With if not Q[ok] after a connectHTML you can query whether the action has been successful. |