2017-04-18 24 views
1

我想運行一個測試套件無頭(使用PhantomJS)編寫的量角器,但是當我運行命令'phantomjs testSuiteFile.js'我得到錯誤:ReferenceError: Can't find variable: browser。瀏覽器變量在我所有的測試中都很重要,所以有沒有辦法讓phantomjs找到使用瀏覽器對象的&?與PhantomJS使用量角器的'瀏覽器'對象

我也試過配置我的量角器配置文件使用phantomjs,我開始硒的webdriver使用在文檔中推薦的命令phantomjs:phantomjs --webdriver=9134protractor 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();} 

回答

0

這不是如何ProtractorPhantomJS一起工作:但是當我運行phantomjs myTest.js

myTest.js myTest.js工作。您需要execute protractor command from the command-line以使browser和其他量角器全局變量初始化。

+0

感謝您的建議,我更新了我的問題以包含它 – John123

相關問題