ClickBy Command

From GXtest Wiki
Jump to: navigation, search
Spanish.gif
English.gif
Japan.gif

Contents

ClickBy

ClickBy command is used to simulate a click event over an element or control inside the page. It works like the Click command, but with the difference that the control that will be clicked can be a custom or non-native GeneXus element. This allows GXtest to automate over elements that may be not generated with GeneXus, or with highly customized applications (for example when a button is dynamically generated from webpanel events using JavaScript).

Command parameters

  • Target control: a search criteria for finding the control in the page (for example "id=button1")


Search criteria

The identification criteria for finding a control in the page are:

  • id: An unique identification for the control, it matches the id attribute of the HTML elements. Example: id=button1
  • name: Name of the control, it matches the name attribute of the HTML elements. Example: name=Confirm
  • class: Control class, it matches the class attribute of the HTML elements. Example: class=BigButtons
  • xpath: Xpath that identifies the control inside the HTML DOM structure.


Considerations

  • Name and class searches may have multiple matches, because they do not uniquely identify an element in the HTML. In the case of multiple matches, the first match will be used.
  • The use of xpath is discouraged, as is the less robust of all options. This is because minor changes in the HTML DOM may break the test case, as the xpath to the control may change and it will no longer be found by GXtest (for example with a new version of GeneXus generator).
  • Based on the previous comments, it is recommended to use in order of preference: id, name, class, and in the case that none of those three are useful, then you may use xpath.


Example

ClickBy("name=BtnConfirm")