-->

How to access PrimeFaces components through Graphe

2020-05-01 04:13发布

问题:

I'm writing Arquillian+Graphene functional tests for a Java EE web client with Primefaces 6.1 components and would like to write them in the most portable way from the beginning.

I noticed that there's no possibility to perform operations like WebElement.click on any PrimeFaces component which is clickable (e.g. not on p:selectBooleanCheckbox since the WebElement is a div containing another div containing an input), so that I have to

  • figure out how a clickable component is structured for every component and access it via XPath
  • figure the above out for every component after I change the PrimeFaces version

A similar problem is the case for access by id: the clickable element seems to be suffixed with _input, but that's probably as non-portable as the element hierarchy described above.

How to avoid as many problems listed above as possible? Or more abstract: How do people test PrimeFaces components?

The only answer to PrimeFaces fileUpload testing with Selenium WebDriver is proposing my problem as a solution.