1. Preface
    1. About MarathonITE
    2. Supported Platforms
      1. Java/Swing™
      2. Java/FX™
      3. Web Applications
    3. What's New in MarathonITE 5.0
    4. Change Log a.k.a Version History
    5. System Requirements
    6. Copyright Notice
  2. Getting Started
    1. Introduction to Test Automation
      1. Unattended Testing
      2. Semi Automated Testing
      3. Exploratory Testing
    2. MarathonITE Projects
    3. Your First Project
      1. Java/Swing™ Test Project
        1. Application Under Test - SwingSet3
        2. Creating a Project
        3. Recording a Test
        4. Anatomy of a Test Script
        5. Running Tests
        6. Looking at Results
      2. Java/FX™ Test Project
        1. Application Under Test - Ensemble
        2. Creating a Project
        3. Recording a Test
        4. Anatomy of a Test Script
        5. Running Tests
        6. Looking at Results
      3. Web Application Test Project
        1. Application Under Test - DuckDuckGo Search
        2. Creating a Project
        3. Recording a Test
        4. Anatomy of a Test Script
        5. Running Tests
        6. Looking at Results
    4. MarathonITE Sample Projects
  3. User Guide
    1. Installation and Startup
    2. MarathonITE User Interface
      1. Views
      2. Editors
      3. Output Views
    3. Creating Marathonite Test Projects
    4. Recording Tests
    5. Managing Checklists
    6. Exploratory Tests
    7. Semi Automated Tests
    8. Executing Tests
      1. Executing a Test from Editor
        1. Debugging Scripts
        2. Using Script Console
      2. Executing Tests from Test Runner
      3. Executing Tests in Batch Mode
    9. Organizing Tests
      1. Organizing Tests in Folder Heirarchy
      2. Organizing Tests as Features and Stories
      3. Organizing Tests in Suites
      4. Linking Tests to TMS and Issue Manager
    10. Modularizing Test Scripts
      1. Module Methods
      2. Extract Method Refactoring
      3. Using Data Loops
      4. Convert to Data Loop Refactoring
    11. Data Driven Tests
      1. Convert to DDT Refactoring
  4. Advanced Scripting
    1. Ruby Programming Language
    2. Marathon and Ruby
    3. Selenium/WebDriver Bindings
      1. Java/Swing™ Components
      2. Java/FX™ Controls

4.3.2.Java/FX™ Controls

MarathonITE implements a CSS finder for java appplications. You can use WebDriver’s find_element(s) call to quickly find a control in the application.

Under this section, we will go through different kind of seletors that are available.

Simple Selectors

Some of the simple selectors are tagname, * (all), . (self).

Selector Description Example
tagname Selects an element with the given tagname. A tagname is computed by finding the FX superclass of the Control and converting CamelCase to camel-case. ToggleButton -> toggle-button, TextField -> text-field
* Universal Gets all the elements. It retuns list of elements. driver.find_elements(:css, '*')
. Self It returns the same element.
  • tree_view = driver.find_element(:css, 'tree_view')
  • tree_view_1 = tree_view.find_element(:css, '.')
tree_view and tree_view_1 are same.
#id Select a Control with the given id. For example: If control has id : (set through javafx.scene.Node#setId method), you find control using #id.

Above listed selectors can be used on all controls.

Other Selectors

Selector Description Example
[attribute <operation> value] Find controls with the given value for the attribute. The operation can be *= (contains), /= (regex match), = (equals), ^= (startswith), $= (endswith). button[text='Click Me!!']. This selector finds all the buttons whose text is equal to ‘Click Me!!’
:<pseudoclass>: Find controls for which <pseudoclass> returns true. Pseudoclasses avaiable are selected, disable, visible and instance-of('&lt;class>'). text-field:enabled. This selector finds all the text-fields which are enabled.
:: PseudoElements: This selector finds the pseudo elements. driver.find_elements(:css, 'combo-box::all-options')

Operations on controls

Below is the list of controls and the selectors that can be used for it, with examples

Button

Using [attribute <operation> value]

Using <pseudoclass>

ComboBox

Using [attribute <operation> value]

Using <pseudoclass>

Using <pseudoeelement>: Available pseudoelements are nth-option(index) and all-options.

ListView

Using [attribute <operation> value] ruby list_view = driver.find_element(:css, 'list-view[id ^= 'Places']')

Using <pseudoclass>

Using <pseudoeelement>: Available pseudoelements are nth-item(index), all-items and editor.

TabPane

Using [attribute <operation> value]

Using <pseudoelement>: Available pseudoelements are nth-tab(index) and all-tabs.

TableView

Using [attribute <operation> value]

Using <pseudoelement>: Available pseudoelements are mnth-cell(row, column), all-cells and editor.

TreeView

Using [attribute <operation> value]

Using <pseudoelement>: Available pseudoelements are nth-node(index), all-nodes and root.

TreeTableView

Using [attribute <operation> value]

Using <pseudoelement>: Available pseudoelements are mnth-cell(row, column) and all-cells.

Getting Attribute

You can get text from a control. This returns a string value.

You can use above code in marathon test scripts to get button’s text.
The web driver instance is available as driver within the script. You can access Java/FX Control’s attribute using webdriver’s attribute method.

For example: If you want to get tab count from TabPane

Webdriver’s attribute method always return String.

Suggest Edit