我试图让它每次访问 nike.com 运动鞋页面时,它都会自动选择我的鞋码,将其添加到购物车,然后为我结账。每次我尝试运行脚本时,我都会收到此错误
错误:脚本“My Fancy New Userscript”的执行失败!硒未定义
这是我的脚本:
// ==UserScript==
// @name My Fancy New Userscript
// @namespace http://*/*
// @version 0.1
// @description enter something useful
// @match http://*/*
// @copyright 2012+, You
// ==/UserScript==
selenium.select("class=selectBox-label", "10"); // this selects size 10
selenium.click("class=add-to-cart nike-button nike-button-orange");
selenium.waitForElement("class=checkout-button nike-button nike-button-orange");
selenium.click("class=checkout-button nike-button nike-button-orange");
非常感谢您的帮助,谢谢!
编辑:
我刚刚通过 JSLint 运行它,并得到了这个错误:
'selenium' was used before it was defined. (Line 1 Character 1) ----> selenium.select("class=selectBox-label", "10"); // this selects size 10