您好我需要Angular2上的量角器帮助,
当我使用Firefox运行量角器时,Firefox会启动并显示一个空白选项卡。这就是我得到的(没有规格执行)。
我尝试使用directConnect: true
和seleniumAddress
选项。
Node Version: 6.9.1
NPM version: 3.10.8
Protractor Version: 5.1.0
Angular Version: 2.4.0
Browser(s): Firefox 52.0.1
Operating System and Version Win7
selenium-server-standalone-3.3.1.jar
geckodriver-v0.15.0.exe
我用angular-cli开始了新项目。我不能使用只有Chrome的Firefox。 我使用便携式Firefox。
量角器配置文件:
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'firefox',
'marionette': 'false',
// FF 52
// "firefox_binary": "D:/Users/tools/FirefoxPortable/FirefoxPortable.exe",
// "binary_": "D:/Users/tools/FirefoxPortable/FirefoxPortable.exe"
// FF 51
// "firefox_binary": "D:/Users/tools/Firefor_51/FirefoxPortable/FirefoxPortable.exe",
// "binary_": "D:/Users/tools/Firefor_51/FirefoxPortable/FirefoxPortable.exe"
// FF 53b1
// "firefox_binary": "D:/Users/tools/Firefox_53_beta1/FirefoxPortableTest/FirefoxPortable.exe",
// "binary_": "D:/Users/tools/Firefox_53_beta1/FirefoxPortableTest/FirefoxPortable.exe"
// FF 47
"firefox_binary": "D:/Users/tools/Firefox_47/Portable_Firefox_47/FirefoxLoader.exe",
"binary_": "D:/Users/tools/Firefox_47/Portable_Firefox_47/FirefoxLoader.exe"
},
seleniumAddress: 'http://localhost:4444/wd/hub',
// seleniumServerJar: 'D:/Users/T0178964/Documents/Mes Outils Personnels/git/polydora/angular/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.0.0-beta4.jar',
// directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
},
debug: true,
troubleshoot: true
};
启动selenium服务器的输出:
$ node_modules/protractor/bin/webdriver-manager start
[18:55:22] I/start - java -Dwebdriver.chrome.driver=D:\Users\T0178964\Documents\Mes Outils Personnels\git\polydora\angular\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.28.exe -Dwebdriver.gecko.driver=D:\Users\T0178964\Documents\Mes Outils Personnels\git\polydora\angular\node_modules\protractor\node_modules\webdriver-manager\selenium\geckodriver-v0.15.0.exe -jar D:\Users\T0178964\Documents\Mes Outils Personnels\git\polydora\angular\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.3.1.jar -port 4444
[18:55:22] I/start - seleniumProcess.pid: 7308
18:55:22.632 INFO - Selenium build info: version: '3.3.1', revision: '5234b32'
18:55:22.632 INFO - Launching a standalone Selenium Server
2017-03-30 18:55:22.648:INFO::main: Logging initialized @250ms to org.seleniumhq.jetty9.util.log.StdErrLog
18:55:22.695 INFO - Driver class not found: com.opera.core.systems.OperaDriver
18:55:22.695 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
18:55:22.695 INFO - Driver class not found: com.opera.core.systems.OperaDriver
18:55:22.695 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
18:55:22.695 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform VISTA
2017-03-30 18:55:22.741:INFO:osjs.Server:main: jetty-9.2.20.v20161216
2017-03-30 18:55:22.773:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@57baeedf{/,null,AVAILABLE}
2017-03-30 18:55:22.804:INFO:osjs.AbstractConnector:main: Started ServerConnector@56ef9176{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-03-30 18:55:22.804:INFO:osjs.Server:main: Started @402ms
18:55:22.804 INFO - Selenium Server is up and running
运行测试的输出:
$ ng e2e
** NG Live Development Server is running on http://localhost:49155 **
Hash: 713103cecaac4e30686e
Time: 9235ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 559 kB {4} [initial] [rendered]
chunk {1} main.bundle.js, main.bundle.js.map (main) 45.4 kB {3} [initial] [rendered]
chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 11.4 kB {4} [initial] [rendered]
chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 3.32 MB [initial] [rendered]
chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.
[18:32:27] I/update - chromedriver: file exists D:\Users\T0178964\Documents\Mes Outils Personnels\git\polydora\angular\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.28.zip
[18:32:27] I/update - chromedriver: unzipping chromedriver_2.28.zip
[18:32:28] I/update - chromedriver: chromedriver_2.28.exe up to date
[18:32:28] D/launcher - Running with --troubleshoot
[18:32:28] D/launcher - Protractor version: 5.1.1
[18:32:28] D/launcher - Your base url for tests is http://localhost:49155
[18:32:28] I/launcher - Running 1 instances of WebDriver
[18:32:28] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
当我启动ng e2e
时,我有selenium bash:
18:55:22.804 INFO - Selenium Server is up and running
18:57:35.120 INFO - SessionCleaner initialized with insideBrowserTimeout 0 and clientGoneTimeout 1800000 polling every 180000
18:57:35.136 INFO - Executing: [new session: Capabilities [{marionette=false, binary_=D:/Users/T0178964/Documents/Mes Outils Personnels/Outils/Firefox_47/Portable_Firefox_47/FirefoxLoader.exe, count=1, browserName=firefox, moz:firefoxOptions={binary=D:/Users/T0178964/Documents/Mes Outils Personnels/Outils/Firefox_47/Portable_Firefox_47/FirefoxLoader.exe}}]])
18:57:35.183 INFO - Creating a new session for Capabilities [{marionette=false, binary_=D:/Users/T0178964/Documents/Mes Outils Personnels/Outils/Firefox_47/Portable_Firefox_47/FirefoxLoader.exe, count=1, browserName=firefox, moz:firefoxOptions={binary=D:/Users/T0178964/Documents/Mes Outils Personnels/Outils/Firefox_47/Portable_Firefox_47/FirefoxLoader.exe}}]
18:57:35.386 INFO - Preferring the firefox binary in these options (D:\Users\T0178964\Documents\Mes Outils Personnels\Outils\Firefox_47\Portable_Firefox_47\FirefoxLoader.exe rather than /Users/T0178964/Documents/Mes Outils Personnels/Outils/Firefox_47/Portable_Firefox_47/FirefoxLoader.exe)
18:57:35.386 INFO - Preferring the firefox binary in these options (D:\Users\T0178964\Documents\Mes Outils Personnels\Outils\Firefox_47\Portable_Firefox_47\FirefoxLoader.exe rather than null)
1490893055464 geckodriver INFO Listening on 127.0.0.1:40563
1490893056072 mozprofile::profile INFO Using profile path D:\Users\T0178964\AppData\Local\Temp\rust_mozprofile.1j0kFbkoNGKs
1490893056072 geckodriver::marionette INFO Starting browser D:\Users\T0178964\Documents\Mes Outils Personnels\Outils\Firefox_47\Portable_Firefox_47\FirefoxLoader.exe with args []
1490893056088 geckodriver::marionette INFO Connecting to Marionette on localhost:56830
编辑:我的规范文件的内容
app.e2e-spec.ts:
import { PartnerNgProjectPage } from './app.po';
describe('partner-ng-project App', () => {
let page: PartnerNgProjectPage;
beforeEach(() => {
console.log('TEST beforeEach');
page = new PartnerNgProjectPage();
});
it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
});
});
app.po.ts:
import { browser, element, by } from 'protractor';
export class PartnerNgProjectPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
我也试过了node_modules/protractor/bin/webdriver-manager start --versions.standalone 3.0.0-beta4
Firefox正在启动,但没有任何反应,只是一个空屏幕。
任何想法可能导致这个问题?