.size()

  • function
FuncUnit.prototype.size  

size([size] [,timeout] [,success] [,message])

Gets the number of elements matched by the selector or waits until the the selector is size. You can also provide a function that continues to the next action when it returns true.

F(".recipe").size()//gets the number of recipes

F(".recipe").size(2)//waits until there are 2 recipes

//waits until size is count
F(".recipe").size(function(size){
  return size == count;
})

Parameters

  1. size {Number | function()}Optional

    number or a checking function.

  2. timeout {Number}Optional

    overrides FuncUnit.timeout. If provided, the wait will fail if not completed before this timeout.

  3. success {function()}Optional

    a callback that will run after this action completes.

  4. message {String}Optional

    if provided, an assertion will be passed when this wait condition completes successfully

Returns

{Number}

if the size parameter is not provided, size returns the number of elements matched.