我试图让每一个地方我访问nike.com运动鞋页面时,它会自动挑选我的鞋的大小,将其添加到购物车,并检查了我。每次我尝试运行脚本,我不断收到此错误为什么我的Tampermonkey脚本抛出“Selenium没有定义”?
ERROR: Execution of script 'My Fancy New Userscript' failed! selenium is not defined
这里是我的脚本:
// ==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
您在使用前应定义“硒”。确保您的脚本在包含硒之后运行。 – jeroenvisser101 2013-02-23 15:51:46