To meet more automation and data extraction scenarios, the following APIs have been enhanced with the options
parameter, supporting more flexible DOM information and screenshots:
agent.aiQuery(dataDemand, options)
agent.aiBoolean(prompt, options)
agent.aiNumber(prompt, options)
agent.aiString(prompt, options)
options
parameterdomIncluded
: Whether to pass the simplified DOM information to AI model, default is off. This is useful for extracting attributes that are not visible on the page, like image links.screenshotIncluded
: Whether to pass the screenshot to AI model, default is on.Have you ever encountered a scenario where you need to automate a right-click operation? Now, Midscene supports a new agent.aiRightClick()
method!
Perform a right-click operation on the specified element, suitable for scenarios where right-click events are customized on web pages. Please note that Midscene cannot interact with the browser's native context menu after right-click.
locate
: Describe the element you want to operate in natural languageoptions
: Optional, supports deepThink
(AI fine-grained positioning) and cacheable
(result caching)In this report file, we show a complete example of using the new aiRightClick
API and new query parameters to extract contact data including hidden attributes.
Report file: puppeteer-2025-06-04_20-34-48-zyh4ry4e.html
The corresponding code can be found in our example repository: puppeteer-demo/extract-data.ts