In JMeter the driver is passed into the test.
WDS object passed in
Specifically we are provided an object called WDS with the following properties. (from the docs). Take special notice of WDS.browser as this is the WebDriver we use to drive our test.
- WDS.name – is the value provided in the Name field (above).
- WDS.parameters – is the value provided in the Parameters field (above).
- WDS.args – is an array of the strings provided in the Parameters field, but split by the space ‘ ‘ character. This allows the scripter to provide a number of strings as input and access each one by position.
- WDS.log – is a Logger instance to allow the scripter to debug their scripts by writing information to the jmeter log file (JMeter provides a GUI for its log entries)
- WDS.browser – is the configured Web Driver browser that the scripter can script and control. There is detailed documentation on this object on the Selenium Javadocs page.
- WDS.sampleResult – is used to log when the timing should start and end. Furthermore, the scripter can set success/failure state on this object, and this SampleResult is then used by the JMeter reporting suite. The JMeter javadocs provide more information on the API of this object.
WDS.browser is the WebDriver we will use through the test to execute the steps.
- Example Output – https://www.redline13.com/share/testplan/20355
- JMX File for full test – https://www.redline13.com/share/download/20355?path=testplan
Code with comments