Action Types

ExtractTable Action

Extract the values of elements as a table

This type of action will be created by Bytebot when prompted to execute operations on multiple elements. For example, getting all the names and addresses from a list.

Example:

1// On a page with a list of employees with name, address and link to their profile
2const actions = await bytebot.extract(
3 Table([
4 Column("Name", Text("The name of the employee")),
5 Column("Address", Text("The address of the employee")),
6 Column("Link", Attribute("The profile link of the employee")),
7 ]),
8 page
9 );

Example of returned actions:

1 {
2 type: "ExtractTable",
3 xpath: "/html/body/div[1]/div[2]/div[2]/tr",
4 rows:[
5 [
6 {
7 name: "Name",
8 action: {
9 xpath: "/html/body/div[1]/div[2]/div[2]/tr[1]/td[1]",
10 type: "CopyText"
11 }
12 },
13 {
14 name: "Address",
15 action: {
16 xpath: "/html/body/div[1]/div[2]/div[2]/tr[1]/td[2]",
17 type: "CopyText"
18 }
19 },
20 {
21 name: "Link",
22 action: {
23 xpath: "/html/body/div[1]/div[2]/div[2]/tr[1]/td[3]/a",
24 type: "CopyAttribute",
25 attribute: "href"
26 }
27 }
28 ]
29
30 ...
31
32 ]
33 }

When executed, this action will return an array of Record<string,string|null>.