Class SetTheValueBuilder
- Namespace
- CSF.Screenplay.Selenium
- Assembly
- CSF.Screenplay.Selenium.dll
Builds actions for setting values in Selenium web elements.
public class SetTheValueBuilder : IGetsPerformable, SetTheValueBuilder.IChoosesValue
- Inheritance
-
SetTheValueBuilder
- Implements
- Inherited Members
Constructors
SetTheValueBuilder(ITarget)
Initializes a new instance of the SetTheValueBuilder class with the specified target.
public SetTheValueBuilder(ITarget target)
Parameters
targetITargetThe target web element for which to build value-setting actions.
Methods
AsIfSetInteractively()
Gets a performable which, whilst setting the value programatically, attempts to simulate setting it interactively in the browser.
public IPerformable AsIfSetInteractively()
Returns
- IPerformable
A performable
Remarks
Use this method to work around limitations in the web browser/WebDriver, as it is an imperfect solution.
When this method is used, it configures the performable to use JavaScript which will not only update the value of the
specified element. It will additionally trigger HTML/JavaScript events upon the element such as focus,
input, change and blur in an attempt to simulate an interactive change.
The reason for this is that client web page functionality may be listening to these events and would be exercised if the element value were updated by a human being interacting with the web page. However when JS is used to update the value, those events are not fired. This method fires the events artificially.
To(object)
Gets a builder for a performable which sets the target element to the value specified in this method.
public SetTheValueBuilder To(object value)
Parameters
valueobjectThe new value for the element
Returns
- SetTheValueBuilder
A builder for a performable
Remarks
If you are using this method to update the value of an element because you are working around a limitation in a web browser/ WebDriver, then strongly consider following it with AsIfSetInteractively().