puppeteer - Puppeteer 不是有效的选择器
问题描述
我正在尝试使用 puppeteer 来抓取预先加载到输入框中的信息。我相信这意味着它是占位符。
我似乎无法让选择器工作。我右键单击输入框并使用chrome dev工具复制选择器,我得到#company-legal-name > span > ng-transclude > wf:textfield > div > input
但是如果我把它放到控制台中
document.querySelector('#company-legal-name > span > ng-transclude > wf:textfield > div > input')
我收到这个错误
VM637:1 Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '#company-legal-name > span > ng-transclude > wf:textfield > div > input' is not a valid selector.
at <anonymous>:1:10
我尝试了许多不同的方法,但它永远无法找到选择器。如果这有所不同,该页面似乎是有角度的。不幸的是,我无法链接该页面,因为它被锁定为非管理员。
PS:
document.getElementById('#company-legal-name')
返回null
解决方案
wf:textfield
不是有效的 CSS 选择器,因此会出现语法错误:
> document.querySelector('wf:textfield')
SyntaxError: 'wf:textfield' is not a valid selector
而没有wf:
它被接受:
>document.querySelector('textfield')
null
我也对选择器有疑问ng-transclude
,我猜它应该是一个(Angular?)标签名称。
推荐阅读
- sql - SQL 语句没有返回正确的数据
- postgresql - 如何使用烧瓶迁移迁移创建视图?
- java - Javac 不编译依赖于 jar 和类的 java 类
- javascript - 如何使用 ajax 从烧瓶中获取数据到我的模板?
- distributed-system - Dolphindb集群支持多个数据节点使用同一个磁盘目录?
- ios - 如何将可观察的元组元素与可观察的单个元素结合起来?
- java - 使用 RestHighLevelClient 的 ElasticSearch 批量插入错误
- javascript - 根据操作系统分辨率和 CSS 位置,会出现轻微的空间
- c# - 无法捕获在具有调试模式的任务中生成的异常
- javascript - 奇怪的 Java Base64.decode 结果