jquery $x xpath

Run Settings
LanguageC++
Language Version
Run Command
//div[@class="product-list"]/div[@data-price > 3000] chrome 中使用 $x,比jquery更好玩 https://www.cnblogs.com/xiongbatianduxing/p/19085925 // 使用JavaScript等待元素出现 function waitForElement(xpath, timeout = 5000) { const startTime = new Date().getTime(); return new Promise((resolve, reject) => { const checkExist = setInterval(() => { const element = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; if (element) { clearInterval(checkExist); resolve(element); } else if (new Date().getTime() - startTime > timeout) { clearInterval(checkExist); reject(new Error(`元素未在${timeout}ms内出现: ${xpath}`)); } }, 100); }); } // 使用方法 waitForElement('//div[@id="dynamic-content"]') .then(element => console.log('找到元素:', element)) .catch(error => console.error(error));
Editor Settings
Theme
Key bindings
Full width
Lines