Cinnamon Documentation

Assert
BaseExplicitWaitTest
BaseTest
Capabilities
Context
Cookie
CookieManager
CSSLocator
ElementLocator
ExpectedCondition
ExpectedConditions
OrgUnderTest
PageObject
RemoteAlert
RemoteMouse
RemoteTouch
RemoteWebDriver
RemoteWebDriverServiceProvider
SelectOptionAdapter
StandardLayoutLocator
TableWebElement
TestUtil
VisualforceByHtmlTagLocator
VisualforceChildLocator
VisualforceLocator
Wait
WebElement
WindowSize

VisualforceLocator

global with sharing class VisualforceLocator extends ElementLocator
DescriptionVisualforceLocator locates an HTML element generated by a Visualforce tag. Similar to ElementLocator, a VisualforceLocator must be passed to the PageObject.getElement() method as an argument to obtain a WebElement object.

For example, the following code snippent uses VisualforceLocator to locate a save button and an opportunity table on a Visualforce page.


   cinnamon.WebElement saveButton = getElement(new cinnamon.VisualforceLocator('apex:commandButton', 'saveButton'));
   cinnamon.TableWebElement oppTable = new cinnamon.TableWebElement(getElement(new cinnamon.VisualforceLocator('apex:pageBlockTable', 'oppTable')));
 

Currently, VisualforceLocator supports the tags found in the VisualforceTag enumeration, including:

  • apex:commandButton
  • apex:iFrame
  • apex:inputField
  • apex:outputField
  • apex:pageBlockTable
  • apex:pageMessages
  • apex:selectList
For Visualforce tags not listed above, you can instead use VisualforceByHtmlTagLocator to locate elements.
SeeWebElement, VisualforceByHtmlTagLocator

Methods

  getLocator

global override String getLocator()
DescriptionReturns the CSS selector used by this particular VisualforceLocator object.
ReturnsThe CSS selector that by this particular VisualforceLocator object.

  VisualforceLocator

global VisualforceLocator(VisualforceTag vfTag, String vfId)
Parameters
vfTagThe Visualforce tag used to generate an HTML element.
vfIdThe Id attribute of the Visualforce tag.

For example, the following code snippet shows how to retrieve a WebElement that represents an input element generated by <apex:inputField> tag with 'name' set to its Id attribute

cinnamon.WebElement nameField = getElement(new VisualforceLocator('apex:inputField', 'name');

  VisualforceLocator

global VisualforceLocator(VisualforceTag vfTag, String vfId, String attributeExpression)
Parameters
vfTagThe Visualforce tag used to generate an HTML element.
vfIdThe Id attribute of the Visualforce tag.
attributeExpressionAn expression used to locate an element based on its attributes and the values of those attributes.

For example, the following code snippet retrieves a selectOptions element whose value is "USA":

cinnamon.WebElement optionUSA = getElement(new VisualforceLocator('apex:selectOptions', null, 'value="USA"'));