No default proposals for protractor browser.actions() and throws TypeError: browser.actions(...).dragAndDrop(...).perfrom is not a function
No default proposals for protractor browser.actions() and throws TypeError: browser.actions(...).dragAndDrop(...).perfrom is not a function
我在 window 10 OS 中使用量角器版本 5.4.2,我使用 Eclipse Java EE IDE for Web Developers.Version 编写脚本:带有 Tern 插件的 Photon Release (4.8.0)。
我没有收到 browser.actions() 的默认提案。由于以下错误,我的执行也失败了。
Message:
Failed: browser.actions(...).dragAndDrop(...).perfrom is not a function
Stack:
TypeError: browser.actions(...).dragAndDrop(...).perfrom is not a function
at UserContext. (F:\Learning\Repositories\protractor-sam-test-scripts\EclipsePro\src\com\sam\scriptjs\draganddrop.spec.js:15:45)
at C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:112:25
at new ManagedPromise (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1077:7)
at ControlFlow.promise (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2505:12)
at schedulerExecute (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:95:18)
at TaskQueue.execute_ (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3084:14)
at TaskQueue.executeNext_ (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3067:27)
at asyncRun (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2974:25)
at C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:668:7
at
From: Task: Run it("Drag and drop") in control flow
at UserContext. (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:94:19)
From asynchronous test:
Error
at Suite. (F:\Learning\Repositories\protractor-sam-test-scripts\EclipsePro\src\com\sam\scriptjs\draganddrop.spec.js:11:4)
at Object. (F:\Learning\Repositories\protractor-sam-test-scripts\EclipsePro\src\com\sam\scriptjs\draganddrop.spec.js:2:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
我已经更新了 protractor
和 webdriver-manager
版本,但错误仍然存在。
请看我的spec.js
//draganddrop.spec.js
describe('drag and drop trial', function() {
//Each single it function is a test script
it('first spec', function() {
browser.driver.get('https://codef0rmer.github.io/angular-dragdrop/#!/');
expect(browser.getTitle()).toEqual('Drag and Drop for AngularJS');
});
it('Drag and drop', function() {
var from=element(by.model('list1'));
var to=element(by.model('list2'));
//drag and drop source to Destination
browser.actions().dragAndDrop(from,to).perfrom();
browser.sleep(7500);
});
})
尝试使用此代码:
//1st way: dragging one element to another
browser.actions().mouseDown(from).mouseMove(to).mouseUp().perform();
有 3 种实现 dragAndDrop 的方法,我发现量角器中的这种方法最合适。
我在 window 10 OS 中使用量角器版本 5.4.2,我使用 Eclipse Java EE IDE for Web Developers.Version 编写脚本:带有 Tern 插件的 Photon Release (4.8.0)。
我没有收到 browser.actions() 的默认提案。由于以下错误,我的执行也失败了。
Message: Failed: browser.actions(...).dragAndDrop(...).perfrom is not a function Stack: TypeError: browser.actions(...).dragAndDrop(...).perfrom is not a function at UserContext. (F:\Learning\Repositories\protractor-sam-test-scripts\EclipsePro\src\com\sam\scriptjs\draganddrop.spec.js:15:45) at C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:112:25 at new ManagedPromise (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1077:7) at ControlFlow.promise (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2505:12) at schedulerExecute (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:95:18) at TaskQueue.execute_ (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3084:14) at TaskQueue.executeNext_ (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3067:27) at asyncRun (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2974:25) at C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:668:7 at From: Task: Run it("Drag and drop") in control flow at UserContext. (C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:94:19) From asynchronous test: Error at Suite. (F:\Learning\Repositories\protractor-sam-test-scripts\EclipsePro\src\com\sam\scriptjs\draganddrop.spec.js:11:4) at Object. (F:\Learning\Repositories\protractor-sam-test-scripts\EclipsePro\src\com\sam\scriptjs\draganddrop.spec.js:2:1) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12)
我已经更新了 protractor
和 webdriver-manager
版本,但错误仍然存在。
请看我的spec.js
//draganddrop.spec.js
describe('drag and drop trial', function() {
//Each single it function is a test script
it('first spec', function() {
browser.driver.get('https://codef0rmer.github.io/angular-dragdrop/#!/');
expect(browser.getTitle()).toEqual('Drag and Drop for AngularJS');
});
it('Drag and drop', function() {
var from=element(by.model('list1'));
var to=element(by.model('list2'));
//drag and drop source to Destination
browser.actions().dragAndDrop(from,to).perfrom();
browser.sleep(7500);
});
})
尝试使用此代码:
//1st way: dragging one element to another
browser.actions().mouseDown(from).mouseMove(to).mouseUp().perform();
有 3 种实现 dragAndDrop 的方法,我发现量角器中的这种方法最合适。