Menu
Technical documentation Plugin catalog
Choose a product
Viewing: v1.3.x (latest) Find another version
  • Grafana k6
  • Release notes
    • v1.4.0
    • v1.3.0
    • v1.2.0
    • v1.1.0
    • v1.0.0
    • v0.57.0
    • v0.56.0
    • v0.55.0
    • v0.54.0
    • v0.53.0
    • v0.52.0
    • v0.51.0
    • v0.50.0
    • v0.49.0
    • v0.48.0
    • v0.47.0
  • Set up
    • Install k6
      • Troubleshooting
    • Configure your code editor
    • Set up distributed k6
      • Install k6 Operator
      • Upgrade the k6 Operator
      • Usage
        • Run k6 scripts with TestRun CRD
        • Use k6 Operator with k6 extensions
        • Use the k6 Operator with Grafana Cloud k6
        • Configure the TestRun CRD
        • Schedule k6 tests
        • Use the k6 Operator with Istio
      • Troubleshoot
    • Fine-tune OS
    • Usage collection
  • Get started
    • Write your first test
    • Running k6
    • Results output
    • k6 resources
  • Using k6
    • Run a k6 test script
    • HTTP Requests
    • Metrics
      • Built-in metrics
      • Create custom metrics
    • Checks
    • Assertions
    • Thresholds
    • Options
      • How to use options
      • Options reference
    • Test lifecycle
    • Modules
    • Tags and Groups
    • Cookies
    • Protocols
      • HTTP/2
      • WebSockets
      • gRPC
      • SSL/TLS
        • Online Certificate Status Protocol (OCSP)
        • SSL/TLS client certificates
        • SSL/TLS version and ciphers
    • Environment variables
    • Execution context variables
    • Scenarios
      • Concepts
        • Graceful stop
        • Arrival-rate VU allocation
        • Dropped iterations
        • Open and closed models
      • Executors
        • Shared iterations
        • Per VU iterations
        • Constant VUs
        • Ramping VUs
        • Constant arrival rate
        • Ramping arrival rate
        • Externally controlled
      • Advanced Examples
    • Secret source
      • File
      • Mock
    • Test authoring
      • Create a test script using the CLI
      • Create a test script from an OpenAPI definition file
      • Test builder
      • Create tests from recordings
        • Using the browser recorder
        • Using the HAR converter
    • JavaScript and TypeScript mode
  • Using k6 browser
    • Write your first browser test
    • Running browser tests
    • How to write browser tests
      • Asynchronous operations
      • Interact with elements on your webpage
    • Migrate a Playwright script to k6
    • Playwright APIs in k6
    • Recommended practices
      • Handle stale or dynamic elements after navigation
      • Hybrid approach to performance
      • Page object model
      • Prevent cookie banners from blocking interactions
      • Prevent too many time series error
      • Select elements
      • Simulate user input delay
      • Use Page.close to clean up test resources
      • When to use sleep() and page.waitForTimeout()
    • Browser metrics
    • Browser options
    • Migrating browser scripts to k6 v0.52
  • Results output
    • End of test
      • Custom summary
    • Real time
      • Amazon CloudWatch
      • Apache Kafka
      • CSV
      • Datadog
      • Dynatrace
      • Elasticsearch
      • Grafana Cloud k6
      • Grafana Cloud Prometheus
      • InfluxDB
      • JSON
      • Netdata
      • New Relic
      • OpenTelemetry
      • Prometheus remote write
      • StatsD
      • TimescaleDB
    • Web dashboard
    • Grafana dashboards
  • Testing guides
    • Load test types
      • Smoke testing
      • Average-load testing
      • Stress testing
      • Soak testing
      • Spike testing
      • Breakpoint testing
    • Automated performance testing
    • API load testing
    • Calculate concurrent users for load tests
    • Load testing websites
    • Performance testing gRPC services
    • Running distributed tests
    • Running large tests
    • Synthetic monitoring
    • Use Chai with k6
    • Injecting faults with xk6-disruptor
      • xk6-disruptor first steps
      • Requirements
      • Installation
      • Expose your application
      • How xk6-disruptor works
      • xk6-disruptor API
        • Faults
          • gRPC
          • HTTP
          • Pod Termination
        • PodDisruptor
          • Constructor
          • injectGrpcFaults()
          • injectHTTPFaults()
          • terminatePods()
        • ServiceDisruptor
          • Constructor
          • injectGrpcFaults
          • injectHTTPFaults
          • terminatePods()
      • xk6-disruptor examples
        • Inject gRPC faults into Service
        • Inject HTTP faults into Pod
        • Interactive demo
  • JavaScript API
    • Init context
      • open( filePath, [mode] )
    • k6
      • check( val, sets, [tags] )
      • fail( [err] )
      • group( name, fn )
      • randomSeed( int )
      • sleep( t )
    • k6/browser
      • BrowserContext
        • addCookies()
        • addInitScript()
        • clearCookies()
        • clearPermissions()
        • close()
        • Cookie
        • cookies([urls])
        • grantPermissions(permissions[, options])
        • newPage()
        • pages()
        • setDefaultNavigationTimeout(timeout)
        • setDefaultTimeout(timeout)
        • setGeolocation(geolocation)
        • setOffline(offline)
        • waitForEvent(event[, optionsOrPredicate])
      • ConsoleMessage
      • MetricMessage
      • ElementHandle
        • $(selector)
        • $$(selector)
        • boundingBox()
        • check([options])
        • click([options])
        • contentFrame()
        • dblclick([options])
        • dispatchEvent(type, eventInit)
        • fill(value, [options])
        • focus()
        • getAttribute(name)
        • hover([options])
        • innerHTML()
        • innerText()
        • inputValue([options])
        • isChecked()
        • isDisabled()
        • isEditable()
        • isEnabled()
        • isHidden()
        • isVisible()
        • ownerFrame
        • press(key, [options])
        • screenshot([options])
        • scrollIntoViewIfNeeded([options])
        • selectOption(values, [options])
        • selectText(values, [options])
        • setChecked(checked[, options])
        • setInputFiles(file[, options])
        • tap(options)
        • textContent()
        • type(text, [options])
        • uncheck([options])
        • waitForElementState(state[, options])
        • waitForSelector(selector[, options])
      • Frame
        • $(selector)
        • $$(selector)
        • check(selector[, options])
        • childFrames()
        • click(selector[, options])
        • content()
        • dblclick(selector[, options])
        • dispatchEvent(selector, type, eventInit[, options])
        • evaluate(pageFunction[, arg])
        • evaluateHandle(pageFunction[, arg])
        • fill(selector, value[, options])
        • focus(selector[, options])
        • frameElement()
        • getAttribute(selector, name[, options])
        • getByAltText(altText[, options])
        • getByLabel(text[, options])
        • getByPlaceholder(placeholder[, options])
        • getByRole(role[, options])
        • getByTestId(testId)
        • getByText(text[, options])
        • getByTitle(title[, options])
        • goto(url[, options])
        • hover(selector[, options])
        • innerHTML(selector[, options])
        • innerText(selector[, options])
        • inputValue(selector[, options])
        • isChecked(selector[, options])
        • isDetached()
        • isDisabled(selector[, options])
        • isEditable(selector[, options])
        • isEnabled(selector[, options])
        • isHidden(selector[, options])
        • isVisible(selector[, options])
        • locator(selector[, options])
        • name()
        • page()
        • parentFrame()
        • press(selector, key[, options])
        • selectOption(selector, values[, options])
        • setChecked(selector, checked[, options])
        • setContent(html[, options])
        • setInputFiles(selector, file[, options])
        • tap(selector[, options])
        • textContent(selector[, options])
        • title()
        • type(selector, text[, options])
        • uncheck(selector[, options])
        • url()
        • waitForFunction(pageFunction, arg[, options])
        • waitForLoadState(state[, options])
        • waitForNavigation([options])
        • waitForSelector(selector[, options])
        • waitForTimeout(timeout)
        • waitForURL(url[, options])
      • JSHandle
        • asElement()
        • dispose()
        • evaluate(pageFunction[, arg])
        • evaluateHandle(pageFunction[, arg])
        • getProperties()
        • jsonValue()
      • Keyboard
        • down(key)
        • insertText(text)
        • press(key[, options])
        • type(text[, options])
        • up(key)
      • Locator
        • all()
        • boundingBox([options])
        • check([options])
        • clear([options])
        • click([options])
        • contentFrame()
        • count()
        • dblclick([options])
        • dispatchEvent(type, eventInit, [options])
        • evaluate(pageFunction[, arg])
        • evaluateHandle(pageFunction[, arg])
        • fill(value, [options])
        • filter(options)
        • first()
        • focus([options])
        • getAttribute(name, [options])
        • getByAltText(altText[, options])
        • getByLabel(text[, options])
        • getByPlaceholder(placeholder[, options])
        • getByRole(role[, options])
        • getByTestId(testId)
        • getByText(text[, options])
        • getByTitle(title[, options])
        • hover([options])
        • innerHTML([options])
        • innerText([options])
        • inputValue([options])
        • isChecked([options])
        • isDisabled([options])
        • isEditable([options])
        • isEnabled([options])
        • isHidden()
        • isVisible()
        • last()
        • locator(selector[, options])
        • nth(number)
        • press(key, [options])
        • selectOption(values, [options])
        • setChecked(checked[, options])
        • tap([options])
        • textContent([options])
        • type(text, [options])
        • uncheck([options])
        • waitFor([options])
      • FrameLocator
        • getByAltText(altText[, options])
        • getByLabel(text[, options])
        • getByPlaceholder(placeholder[, options])
        • getByRole(role[, options])
        • getByTestId(testId)
        • getByText(text[, options])
        • getByTitle(title[, options])
        • locator(selector[, options])
      • Mouse
        • click(x, y[, options])
        • dblclick(x, y[, options])
        • down([options])
        • move(x, y[, options])
        • up([options])
      • Page
        • $(selector)
        • $$(selector)
        • bringToFront()
        • check(selector[, options])
        • click(selector[, options])
        • close()
        • content()
        • context()
        • dblclick(selector[, options])
        • dispatchEvent(selector, type, eventInit[, options])
        • emulateMedia([options])
        • emulateVisionDeficiency(type)
        • evaluate(pageFunction[, arg])
        • evaluateHandle(pageFunction[, arg])
        • fill(selector, value[, options])
        • focus(selector[, options])
        • frames()
        • getAttribute(selector, name[, options])
        • getByAltText(altText[, options])
        • getByLabel(text[, options])
        • getByPlaceholder(placeholder[, options])
        • getByRole(role[, options])
        • getByTestId(testId)
        • getByText(text[, options])
        • getByTitle(title[, options])
        • goto(url[, options])
        • hover(selector[, options])
        • innerHTML(selector[, options])
        • innerText(selector[, options])
        • inputValue(selector[, options])
        • isChecked(selector[, options])
        • isClosed()
        • isDisabled(selector[, options])
        • isEditable(selector[, options])
        • isEnabled(selector[, options])
        • isHidden(selector[, options])
        • isVisible(selector[, options])
        • keyboard
        • locator(selector[, options])
        • mainFrame()
        • mouse
        • on(event, handler)
        • opener()
        • press(selector, key[, options])
        • reload([options])
        • route(url, handler)
        • screenshot([options])
        • selectOption(selector, values[, options])
        • setChecked(selector, checked[, options])
        • setContent(html[, options])
        • setDefaultNavigationTimeout(timeout)
        • setDefaultTimeout(timeout)
        • setExtraHTTPHeaders(headers)
        • setInputFiles(selector, file[, options])
        • setViewportSize(viewportSize)
        • tap(selector[, options])
        • textContent(selector[, options])
        • throttleCPU(cpuProfile)
        • throttleNetwork(networkProfile)
        • title()
        • touchscreen
        • type(selector, text[, options])
        • uncheck(selector[, options])
        • unroute(url)
        • unrouteAll()
        • url()
        • viewportSize()
        • waitForFunction(pageFunction, arg[, options])
        • waitForLoadState(state[, options])
        • waitForNavigation([options])
        • waitForRequest(urlPattern[, options])
        • waitForResponse(urlPattern[, options])
        • waitForSelector(selector[, options])
        • waitForTimeout(timeout)
        • waitForURL(url[, options])
        • workers()
      • Request
        • allHeaders()
        • frame()
        • headers()
        • headersArray()
        • headerValue(name)
        • isNavigationRequest()
        • method()
        • postData()
        • postDataBuffer()
        • resourceType()
        • response()
        • size()
        • timing()
        • url()
      • Response
        • allHeaders()
        • body()
        • frame()
        • headers()
        • headersArray()
        • headerValue(name)
        • headerValues(name)
        • json()
        • ok()
        • request()
        • securityDetails()
        • serverAddr()
        • size()
        • status()
        • statusText()
        • text()
        • url()
      • Route
        • abort([errorCode])
        • continue([options])
        • fulfill(options)
        • request()
      • Touchscreen
        • tap()
      • Worker
        • url()
      • closeContext()
      • context()
      • isConnected()
      • newContext([options])
      • newPage([options])
      • version()
    • k6/crypto
      • createHash( algorithm )
      • createHMAC( algorithm, secret )
      • hmac( algorithm, secret, data, outputEncoding )
      • md4( input, outputEncoding )
      • md5( input, outputEncoding )
      • randomBytes( int )
      • ripemd160( input, outputEncoding )
      • sha1( input, outputEncoding )
      • sha256( input, outputEncoding )
      • sha384( input, outputEncoding )
      • sha512( input, outputEncoding )
      • sha512_256( input, outputEncoding )
      • sha512_224( input, outputEncoding )
      • Hasher
    • k6/data
      • SharedArray
    • k6/encoding
      • b64decode( input, [encoding], [format] )
      • b64encode( input, [encoding] )
    • k6/execution
    • k6/experimental
      • redis
        • Client
          • Client.decr(key)
          • Client.decrBy(key, decrement)
          • Client.del(keys)
          • Client.exists(keys)
          • Client.expire(key, seconds)
          • Client.get(key)
          • Client.getDel(key)
          • Client.getSet(key, value)
          • Client.hdel(key, fields)
          • Client.hget(key, field)
          • Client.hgetall(key)
          • Client.hincrby(key, field, increment)
          • Client.hkeys(key)
          • Client.hlen(key)
          • Client.hset(key, field, value)
          • Client.hsetnx(key, field, value)
          • Client.hvals(key)
          • Client.incr(key)
          • Client.incrBy(key, increment)
          • Client.lindex(key)
          • Client.llen(key)
          • Client.lpop(key)
          • Client.lpush(key, values)
          • Client.lrange(key, start, stop)
          • Client.lrem(key, count, value)
          • Client.lset(key, index, element)
          • Client.mget(keys)
          • Client.persist(key)
          • Client.randomKey()
          • Client.rpop(key)
          • Client.rpush(key, values)
          • Client.sadd(key, members)
          • Client.sendCommand(command, args)
          • Client.set(key, value, expiration)
          • Client.sismember(key, member)
          • Client.smembers(key)
          • Client.spop(key)
          • Client.srandmember(key)
          • Client.srem(key, members)
          • Client.ttl(key)
        • Options
      • websockets
        • Blob
        • WebSocket
          • WebSocket.addEventListener(event, handler)
          • WebSocket.send(data)
          • WebSocket.close([code])
          • WebSocket.ping()
          • WebSocket.onclose
          • WebSocket.onerror
          • WebSocket.onmessage
          • WebSocket.onopen
          • WebSocket.onping
          • WebSocket.onpong
        • Params
      • csv
        • parse( file, [options] )
        • Parser
        • Options
      • fs
        • File
          • read
          • seek
          • stat
        • open
        • FileInfo
        • SeekMode
      • streams
        • ReadableStream
          • cancel(reason)
          • getReader()
          • CountQueuingStrategy
        • ReadableStreamDefaultReader
          • cancel(reason)
          • read()
          • releaseLock()
        • ReadableStreamDefaultController
          • close()
          • enqueue(chunk)
          • error(reason)
    • k6/html
      • parseHTML( src )
      • Element
        • Element.selection()
      • Selection
        • Selection.attr(name)
        • Selection.children([selector])
        • Selection.closest(selector)
        • Selection.contents()
        • Selection.data([key])
        • Selection.each(fn)
        • Selection.eq(index)
        • Selection.filter(selector)
        • Selection.find(selector)
        • Selection.first()
        • Selection.get(index)
        • Selection.has(selector)
        • Selection.html()
        • Selection.is(selector)
        • Selection.last()
        • Selection.map(fn)
        • Selection.next([selector])
        • Selection.nextAll([selector])
        • Selection.nextUntil([selector], [filter])
        • Selection.not(selector)
        • Selection.parent([selector])
        • Selection.parents([selector])
        • Selection.parentsUntil([selector], [filter])
        • Selection.prev([selector])
        • Selection.prevAll([selector])
        • Selection.prevUntil([selector], [filter])
        • Selection.serialize()
        • Selection.serializeArray()
        • Selection.serializeObject()
        • Selection.size()
        • Selection.slice(start [, end])
        • Selection.text()
        • Selection.toArray()
        • Selection.val()
    • k6/http
      • asyncRequest( method, url, [body], [params] )
      • batch( requests )
      • del( url, [body], [params] )
      • file( data, [filename], [contentType] )
      • get( url, [params] )
      • head( url, [params] )
      • options( url, [body], [params] )
      • patch( url, [body], [params] )
      • post( url, [body], [params] )
      • put( url, [body], [params] )
      • request( method, url, [body], [params] )
      • setResponseCallback( callback )
      • url\`url\`
      • expectedStatuses( statuses )
      • CookieJar
        • CookieJar.clear(url)
        • CookieJar.cookiesForURL(url)
        • CookieJar.delete(url, name)
        • CookieJar.set(url, name, value, [options])
      • FileData
      • Params
      • Response
        • Response.clickLink( [params] )
        • Response.html()
        • Response.json( [selector] )
        • Response.submitForm( [params] )
    • k6/metrics
      • Counter
        • Counter.add(value, [tags])
      • Gauge
        • Gauge.add(value, [tags])
      • Rate
        • Rate.add(value, [tags])
      • Trend
        • Trend.add(value, [tags])
    • k6/net/grpc
      • Client
        • Client.load(importPaths, ...protoFiles)
        • Client.loadProtoset(protosetPath)
        • Client.connect(address [,params])
        • Client.asyncInvoke(url, request [,params])
        • Client.invoke(url, request [,params])
        • Client.close()
        • Client.healthCheck()
      • Params
      • Response
      • Stream
        • Stream.on()
        • Error
        • Stream.end()
        • Stream.write()
        • Event Handler
        • Metadata
      • Constants
    • k6/secrets
    • k6/timers
    • k6/x/dns
      • resolve( query, recordType, nameserver )
      • lookup( hostname )
    • k6/ws
      • connect( url, params, callback )
      • Params
      • Socket
        • Socket.close([code])
        • Socket.on(event, callback)
        • Socket.ping()
        • Socket.send(data)
        • Socket.sendBinary(data)
        • Socket.setInterval(callback, interval)
        • Socket.setTimeout(callback, delay)
    • Error Codes
    • crypto
      • getRandomValues
      • CryptoKey
      • randomUUID
      • SubtleCrypto
        • decrypt
        • deriveBits
        • digest
        • encrypt
        • exportKey
        • generateKey
        • importKey
        • sign
        • verify
      • AesCbcParams
      • AesCtrParams
      • AesGcmParams
      • RsaOaepParams
      • AesKeyGenParams
      • CryptoKeyPair
      • EcKeyGenParams
      • EcdhKeyDeriveParams
      • EcdsaParams
      • RsaPssParams
      • HmacKeyGenParams
      • RsaHashedImportParams
      • RSAHashedKeyGenParams
      • JsonWebKey
    • jslib
      • aws
        • AWSConfig
        • EventBridgeClient
          • putEvents
        • KinesisClient
          • createStream
          • deleteStream
          • getRecords
          • getShardIterator
          • listShards
          • listStreams
          • putRecords
        • KMSClient
          • generateDataKey
          • listKeys
          • KMSDataKey
          • KMSKey
        • LambdaClient
          • invoke
        • S3Client
          • abortMultipartUpload
          • completeMultipartUpload
          • copyObject
          • createMultipartUpload
          • deleteObject
          • getObject
          • listBuckets
          • listObjects
          • putObject
          • uploadPart
          • Bucket
          • Object
          • S3MultipartUpload
          • S3Part
          • S3UploadedObject
        • SecretsManagerClient
          • createSecret
          • deleteSecret
          • getSecret
          • listSecrets
          • putSecretValue
          • Secret
        • SignatureV4
          • presign
          • sign
        • SQSClient
          • deleteMessage
          • listQueues
          • receiveMessages
          • sendMessage
          • sendMessageBatch
        • SystemsManagerClient
          • getParameter
          • SystemsManagerParameter
      • httpx
        • asyncRequest(method, url, [body], [params])
        • request(method, url, [body], [params])
        • get(url, [body], [params])
        • post(url, [body], [params])
        • put(url, [body], [params])
        • patch(url, [body], [params])
        • delete(url, [body], [params])
        • options(url, [body], [params])
        • head(url, [body], [params])
        • trace(url, [body], [params])
        • batch( requests )
        • setBaseUrl( url )
        • addHeader( key, value )
        • addHeaders( object )
        • clearHeader( name )
        • addTag( key, value )
        • addTags( object )
        • clearTag( name )
      • k6chaijs
        • config
        • describe( name, function )
        • expect()
        • Error handling
      • http-instrumentation-pyroscope
        • instrumentHTTP
        • Client
      • http-instrumentation-tempo
        • instrumentHTTP
        • Client
        • Options
      • utils
        • randomIntBetween(min, max)
        • randomItem(array)
        • randomString(length, [charset])
        • uuidv4()
        • findBetween(content, left, right, [repeat])
        • normalDistributionStages(maxVus, durationSeconds, [numberOfStages])
        • check( val, sets, [tags] )
      • k6-testing
        • expect()
        • expect.configure()
        • Non-Retrying Assertions
          • toBe()
          • toEqual()
          • toContain()
          • toBeTruthy()
          • toBeFalsy()
          • toBeDefined()
          • toBeGreaterThan()
          • toBeCloseTo()
          • toHaveLength()
          • toHaveProperty()
          • toBeGreaterThanOrEqual()
          • toBeLessThan()
          • toBeNull()
          • toBeUndefined()
          • toContainEqual()
          • toBeLessThanOrEqual()
          • toBeInstanceOf()
          • toBeNaN()
        • Retrying Assertions
          • toBeChecked()
          • toBeDisabled()
          • toBeEditable()
          • toBeEmpty()
          • toBeHidden()
          • toBeVisible()
          • toHaveText()
          • toContainText()
          • toBeEnabled()
          • toHaveAttribute()
          • toHaveValue()
          • toHaveTitle()
          • RetryConfig
    • import.meta
      • resolve( path )
  • Extensions
    • Explore extensions
    • Run a test with extensions
      • Build a k6 binary using Go
      • Build a k6 binary using Docker
    • Create an extension
      • Quick start guide
      • Create an extension with a template
      • JavaScript extensions
      • Output extensions
      • Secret source extensions
      • About the Extensions Registry
      • About the Go-to-JS bridge
  • Examples
    • Get started with k6
      • Test for functional behavior
      • Test for performance
      • Analyze results
      • Reuse and re-run tests
    • Single request
    • HTTP Authentication
    • OAuth Authentication
    • Correlation and Dynamic Data
    • Data parameterization
    • Parse HTML
    • HTML Forms
    • Cookies Example
    • Data Uploads
    • API CRUD Operations
    • Generating UUIDs
    • HTTP2
    • Use global variables in k6
    • WebSockets
    • SOAP
    • Transport Layer Security (TLS)
    • Generating realistic data
    • Bundling and transpiling
    • Functional testing
    • Track transmitted data per URL
    • URLs with query parameters
    • Instant load increase
    • Get timings for an HTTP metric
    • Distribute workloads across VUs
    • Error handler
    • Tutorials
  • Reference
    • Integrations & Tools
    • Archive Command
    • Glossary
    • Versioning and stability guarantees
  • Grafana k6 Studio
  • Grafana Cloud k6
Scroll for more
Documentationbreadcrumb arrow Grafana k6breadcrumb arrow Get started
Open source

Get started

  • Write your first test
  • Running k6
  • Results output
  • k6 resources

Was this page helpful?

Suggest an edit in GitHub
Create a GitHub issue
Email docs@grafana.com
Help and support
Community

Is this page helpful?