PlayWright.Net获取无ID的frame框架,在iframe中按照id定位某个文本框
多页签采用的frame方式,并且嵌套的iframe没有name和id。支持无限嵌套的ifame
private async Task DumpFrameTree(IFrame frame, string indent) { foreach (var child in frame.ChildFrames) { await DumpFrameTree(child, indent + " "); if (child.Url.Contains("/page/card/cardpreview")) {
//定位框架iframe中的元素, var l = child.Locator("#DJBH"); if (l != null) { //BindData(await l.InputValueAsync()
); }
break; }
}
}
private async void btn_Click(object sender, EventArgs e) {
await DumpFrameTree(page.MainFrame, string.Empty);
}
标签:PlayWright,Name,frame,await,iframe,child,Net From: https://www.cnblogs.com/dacong/p/18604985