我正在尝试使用 Puppeteer 访问可点击的输入收音机,以推进我的应用程序调查。下面是选择器和 xpath 标签。
选择器:
#survey-engine > span > div > div > div > div > div.col-xs-12.col-xl-offset-2.col-xl-8.col-lg-offset-1.col-lg-10 > div > div:nth-child(1) > input[type="radio"]
Run Code Online (Sandbox Code Playgroud)
X路径:
//*[@id="survey-engine"]/span/div/div/div/div/div[2]/div/div[1]/input
Run Code Online (Sandbox Code Playgroud)
我一直无法让 xpath 或选择器正常工作。我也试过在下面使用但没有运气。使用选择器查看错误:
>UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: No node found for selector: #survey-engine > span > div > div > div > div > div.col-xs-12.col-xl-offset-2.col-xl-8.col-lg-offset-1.col-lg-10 > div > div:nth-child(1) > input[type="radio"]
at Console.assert (console.js:194:23)
at Frame.click (/Users/erickloos/Desktop/phs-platform/node_modules/puppeteer/lib/FrameManager.js:597:13)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:48518) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside …Run Code Online (Sandbox Code Playgroud)