Using Selenium WebDriver to select JSF/PrimeFaces selectOneMenu options

I'm using JBehave with Selenium WebDriver to test my PrimeFaces (JSF2) application. Selecting an option from a SelectOne option list isn't standard though because of the HTML markup generated by the JSF component.


The facelets code to place the selectOneMenu uses the ID 'state':


This generates HTML div blocks with id's prefixed with this components id:


To select an option, I use a method which manipulates the appropriate divs - this can be used as illustrated below:


To reuse this type of utility method, I put it in a base Page Object class:



Popular posts from this blog

Slow, Buffering, Stuttering Udemy Video

Intellij tip - Joining multiple lines into one

Looking for IT work in Australia? JobReel.com.au!