我试图让某个网站的某些元素按特定顺序点击,但我这样做有点麻烦。以下是我到目前为止的情况:
{
"manifest_version": 2,
"name": "Test Extension",
"version": "0.0",
"offline_enabled": false,
"content_scripts": [
{
"matches": ["http://www.finishline.com/*", "https://www.finishline.com/*"],
"js": ["size.js"],
"run_at": "document_end",
"all_frames": false
}
{
"matches": ["http://www.finishline.com/*", "https://www.finishline.com/*"],
"js": ["content.js"],
"run_at": "document_end",
"all_frames": false
}
]
}
size.js:
document.getElementById('10').click();
content.js:
document.getElementById('buttonAddToCart').click();
以下是我希望此工作的示例页面(点击链接后我想将尺寸10添加到购物车中):http://www.finishline.com/store/product?A=32440&categoryId=cat301568&productId=prod771501