Action Types

CopyAttribute Action

Return the value of an attribute of an Element

This type of action will be created by Bytebot when asked to return a value that is contained in an attribute of an Element. A typical example would be “extract the link from the ‘download’ button”.

Example:

1// On a page with a 'Sign in' button
2const actions = await bytebot.extract(Attribute("The link from the 'Sign in' button"), page);

Example of returned actions:

1[
2 {
3 type: "CopyAttribute",
4 xpath: "/html/body/div[1]/div[2]/div[2]/button[1]",
5 attribute: "href",
6 }
7]

When executed, the action will return a string, or null if the value of the attribute is empty.

1const signInLink = await bytebot.execute(actions, page)
2console.log(signInLink) // https://example.com/signin