You’re browsing the documentation for Vue Test Utils for Vue v2.x and earlier.

To read docs for Vue Test Utils for Vue 3, click here.


Deprecation warning

Using find to search for a Component is deprecated and will be removed. Use findComponent instead. The find method will continue to work for finding elements using any valid selector.

Returns Wrapper of first DOM node or Vue component matching selector.

Use any valid DOM selector (uses querySelector syntax).

  • Arguments:

    • {string} selector
  • Returns: {Wrapper}

  • Example:

import { mount } from '@vue/test-utils'
import Foo from './Foo.vue'
import Bar from './Bar.vue'

const wrapper = mount(Foo)

const div = wrapper.find('div')

const byId = wrapper.find('#bar')
  • Note:

    • You may chain find calls together:
const button = wrapper.find({ ref: 'testButton' })

See also: get.