Skip to main content

setMeta

Overview​

Use the setMeta command to write a value under a specified key in the test's metadata.

To read the metadata, use the getMeta command.

info

This command is implemented within Testplane and is not available in the API WebDriverIO.

Usage​

await browser.setMeta(key, value);

Command Parameters​

NameTypeDescription
keyStringThe key whose value needs to be written in the test's metadata.
valueStringThe value to be saved in the test's metadata.

Usage Examples​

it("should get meta info of test", async ({ browser }) => {
await browser.setMeta("foo", "bar");
await browser.url("/foo/bar?baz=qux");

const val = await browser.getMeta("foo");
console.log(val); // outputs: bar

const url = await browser.getMeta("url");
console.log(url); // outputs: /foo/bar?baz=qux

const meta = await browser.getMeta();
console.log(meta); // outputs: {foo: 'bar', url: '/foo/bar?baz=qux'}
});