package com.wanma.framework_noweb.helper; import cn.hutool.core.collection.ListUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ObjectUtil; import com.microsoft.playwright.*; import com.wanma.apps.constant.PageName; import lombok.extern.slf4j.Slf4j; import java.util.HashMap; import java.util.Map; /** * Playwright 助手类 */ @Slf4j public class PlaywrightHelper { /** * 返回元素的outerHTML值 */ public static String getOuterHTML(ElementHandle element) { if (ObjectUtil.isNull(element)) { return ""; } try { Object html = element.evaluate("node => node.outerHTML"); return StringHelper.toString(html); } catch (Exception e) { System.out.println("【获取outerHTML出错】"); e.printStackTrace(); } return ""; } }