我想運行一個測試套件無頭(使用PhantomJS)編寫的量角器,但是當我運行命令'phantomjs testSuiteFile.js'我得到錯誤:ReferenceError: Can't find variable: browser
。瀏覽器變量在我所有的測試中都很重要,所以有沒有辦法讓phantomjs找到使用瀏覽器對象的&?與PhantomJS使用量角器的'瀏覽器'對象
我也試過配置我的量角器配置文件使用phantomjs,我開始硒的webdriver使用在文檔中推薦的命令phantomjs:phantomjs --webdriver=9134
與protractor protractor.conf.js
跑的配置文件。配置文件被設置爲只運行myTest.js,現在我得到錯誤E/launcher - Error: Error: Cannot find module 'webpage'
。
var WebPage = require('webpage');
page = WebPage.create();
page.open('http://google.com');
page.onLoadFinished = function() {
page.render('googleScreenShot' + '.png');
phantom.exit();}
感謝您的建議,我更新了我的問題以包含它 – John123