Search for an element on the page, starting from the document root. The located element will be returned as a web element JSON object.
First argument to be passed is the locator strategy, which is detailed on the WebDriver docs.

The locator strategy can be one of:

  • css selector
  • link text
  • partial link text
  • tag name
  • xpath


.element(using, value, callback)


Name Type description
using string

The locator strategy to use.

value string

The search target.

callback function

Callback function which is called with the result value.


module.exports = {
 'demo Test' : function(browser) {
    browser.element('css selector', 'body', function(result) {

  'es6 async demo Test': async function(browser) {
    const result = await browser.element('css selector', 'body');
    console.log('result value is:', result.value);

// Example with using page object elements
module.exports = {
 'demo Test with page object' : function(browser) {
    const loginPage =;
    loginPage.api.element('@resultContainer', function(result) {

W3C WebDriver spec