我試圖點(diǎn)擊 JS 網(wǎng)站上顯示的一些文本。顯示的文字是“Supreme?/Vanson Leathers? Worn Leather Jacket”。我的代碼是:const readline = require('readline-sync');const {exec} = require("child_process")function cmdCommand(cmd){ exec(cmd, (error, stdout, stderr) => { if (error) { console.log(`error: ${error.message}`); return; } console.log(`Utilizing the quantum: ${stdout}`); });}const reader = require("readline-sync"); let answer = reader.question("1,2,3,4,5,or 6?: ");answer === "1"? cmdCommand("start chrome https://www.supremenewyork.com/shop/all/jackets",function myFunction() { document.getElementById("Supreme?/Vanson Leathers? Worn Leather Jacket").click(); }):"" 我正在使用 readline-sync 來選擇一系列選項(xiàng),選項(xiàng) 1 啟動(dòng)網(wǎng)站,但我不知道如何單擊文本。
我如何在 JS 中點(diǎn)擊網(wǎng)站上的一段文字?
寶慕林4294392
2023-05-19 14:43:25