失败:this.runnable 不是函数
Failed: this.runnable is not a function
当我尝试 运行 我的量角器测试时,浏览器 window 启动并在几秒钟后关闭,上面没有任何 activity。控制台显示错误
1) Mail suite Send email
- Failed: this.runnable is not a function
- Failed: this.runnable is not a function
Executed 1 of 1 spec (1 FAILED) in 0.074 sec.
[08:01:26] I/launcher - 0 instance(s) of WebDriver still running
[08:01:26] I/launcher - chrome #01 failed 1 test(s)
[08:01:26] I/launcher - overall: 1 failed spec(s)
[08:01:26] E/launcher - Process exited with error code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! protractor-example@1.0.0 e2e: `protractor protractor.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the protractor-example@1.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
这是我的"spec.ts"
import {LoginPage} from '../page-objects/pages/login/login.po';
import {LoginPageHelper} from '../page-objects/pages/login/login-page.helper';
import {browser, By, element, ExpectedConditions} from 'protractor';
import {beforeEach, describe, it} from 'selenium-webdriver/testing';
describe('Mail suite', () => {
let loginPageHelper: LoginPageHelper;
beforeEach(() => {
loginPageHelper = new LoginPageHelper();
});
it('Send email', async () => {
const user1 = browser.params.user1;
await loginPageHelper.goToPage();
await LoginPage.username.sendKeys(user1.username);
await element(By.id('identifierNext')).click();
await browser.wait(ExpectedConditions.visibilityOf(LoginPage.password));
await LoginPage.password.sendKeys(user1.password);
});
});
请帮我调试这个错误。
提前致谢
中定义的内容
protractor.conf.js
函数this.runnable?
也许你想定义它
var runnable
而不是
this.runnable
啊,我终于明白了。
正是我的 "spec.js" 中的这一行导致了上述错误
import {beforeEach, describe, it} from 'selenium-webdriver/testing';
我一用beforeEach,webstorm就警告了。当我尝试使用 webstorm 的自动建议时,它要求做 "Alt+Enter"。它自动导入了这一行。
删除此行已解决问题。
当我尝试 运行 我的量角器测试时,浏览器 window 启动并在几秒钟后关闭,上面没有任何 activity。控制台显示错误
1) Mail suite Send email
- Failed: this.runnable is not a function
- Failed: this.runnable is not a function
Executed 1 of 1 spec (1 FAILED) in 0.074 sec.
[08:01:26] I/launcher - 0 instance(s) of WebDriver still running
[08:01:26] I/launcher - chrome #01 failed 1 test(s)
[08:01:26] I/launcher - overall: 1 failed spec(s)
[08:01:26] E/launcher - Process exited with error code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! protractor-example@1.0.0 e2e: `protractor protractor.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the protractor-example@1.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
这是我的"spec.ts"
import {LoginPage} from '../page-objects/pages/login/login.po';
import {LoginPageHelper} from '../page-objects/pages/login/login-page.helper';
import {browser, By, element, ExpectedConditions} from 'protractor';
import {beforeEach, describe, it} from 'selenium-webdriver/testing';
describe('Mail suite', () => {
let loginPageHelper: LoginPageHelper;
beforeEach(() => {
loginPageHelper = new LoginPageHelper();
});
it('Send email', async () => {
const user1 = browser.params.user1;
await loginPageHelper.goToPage();
await LoginPage.username.sendKeys(user1.username);
await element(By.id('identifierNext')).click();
await browser.wait(ExpectedConditions.visibilityOf(LoginPage.password));
await LoginPage.password.sendKeys(user1.password);
});
});
请帮我调试这个错误。 提前致谢
protractor.conf.js
函数this.runnable? 也许你想定义它
var runnable
而不是
this.runnable
啊,我终于明白了。 正是我的 "spec.js" 中的这一行导致了上述错误
import {beforeEach, describe, it} from 'selenium-webdriver/testing';
我一用beforeEach,webstorm就警告了。当我尝试使用 webstorm 的自动建议时,它要求做 "Alt+Enter"。它自动导入了这一行。
删除此行已解决问题。