After incorporating the option below, Javascript started functioning:
chromeOptions.addArguments("--enable-javascript");
However, I am still in search of a way to utilize widgetVar from PrimeFaces in order to access a PrimeFaces widget.
I attempted:
private static boolean isContentByWidgetVarProDriver(RemoteWebDriver driver, String driverName, String content, String widgetVar) {
WebElement value = null;
try {
value = (WebElement) driver.executeScript("return PF('domains_counter');", driver.findElement(By.id("main")));
if (value.getText().contains(content)) {
return true;
}
} catch (Exception e) {
LOGGER.info("Test failed on {}:\nSelector was '{}' but value '{}' could not be read. '{}' was expected as content.", driverName, widgetVar, value, content);
}
return false;
}
Yet, it outputs null.
It does function in the browser console.