@@ -4,7 +4,11 @@ import path from 'node:path';
44import type { ElementInfo } from '@/extractor' ;
55import type { StaticPage } from '@/playground' ;
66import type { PlaywrightParserOpt , UIContext } from '@midscene/core' ;
7- import { MIDSCENE_REPORT_TAG_NAME , getAIConfig } from '@midscene/core/env' ;
7+ import {
8+ MIDSCENE_REPORT_TAG_NAME ,
9+ MIDSCENE_USE_VLM_UI_TARS ,
10+ getAIConfig ,
11+ } from '@midscene/core/env' ;
812import { uploadTestInfoToServer } from '@midscene/core/utils' ;
913import { NodeType } from '@midscene/shared/constants' ;
1014import { findNearestPackageJson } from '@midscene/shared/fs' ;
@@ -52,24 +56,29 @@ export async function parseContextFromWebPage(
5256 ) ;
5357
5458 const size = await page . size ( ) ;
59+ let screenshotBase64WithElementMarker = screenshotBase64 ;
5560
56- const screenshotBase64WithElementMarker = _opt ?. ignoreMarker
57- ? await compositeElementInfoImg ( {
61+ if ( ! getAIConfig ( MIDSCENE_USE_VLM_UI_TARS ) ) {
62+ if ( _opt ?. ignoreMarker ) {
63+ screenshotBase64WithElementMarker = await compositeElementInfoImg ( {
5864 inputImgBase64 : screenshotBase64 ,
5965 elementsPositionInfo : [ ] ,
6066 size,
61- } )
62- : await compositeElementInfoImg ( {
67+ } ) ;
68+ } else {
69+ screenshotBase64WithElementMarker = await compositeElementInfoImg ( {
6370 inputImgBase64 : screenshotBase64 ,
6471 elementsPositionInfo : elementsPositionInfoWithoutText ,
6572 size,
6673 } ) ;
74+ }
75+ }
6776
6877 return {
6978 content : elementsInfo ! ,
7079 size,
7180 screenshotBase64 : screenshotBase64 ! ,
72- screenshotBase64WithElementMarker,
81+ screenshotBase64WithElementMarker : screenshotBase64WithElementMarker ,
7382 url,
7483 } ;
7584}
0 commit comments