我試圖讓每一個地方我訪問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