首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >没有关于量角器browser.actions()和抛出TypeError的默认建议:browser.actions(.).dragAndDrop(.).perfrom不是函数

没有关于量角器browser.actions()和抛出TypeError的默认建议:browser.actions(.).dragAndDrop(.).perfrom不是函数
EN

Stack Overflow用户
提问于 2019-12-15 13:02:40
回答 1查看 381关注 0票数 1

我正在使用window 10 OS中5.4.2版本的量角器版本,为了编写脚本,我使用Eclipse进行网络Developers.Version:光子发布(4.8.0)和Tern插件。

对于browser.actions()我没有默认的建议。另外,由于以下错误,我的执行失败了。

消息:失败:browser.actions(.).dragAndDrop(.).perfrom不是函数堆栈: TypeError: browser.actions(.).dragAndDrop(.).perfrom不是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)(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:在UserContext的控制流中运行它(“拖放”)。来自异步测试的(C:\Users\sam\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:94:19):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)

我已经更新了我的protractorwebdriver-manager版本,但是错误仍然存在。

请看我的spec.js

代码语言:javascript
复制
//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);
          });

}) 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-12-15 22:45:23

尝试使用以下代码:

代码语言:javascript
复制
    //1st way: dragging one element to another
    browser.actions().mouseDown(from).mouseMove(to).mouseUp().perform();

在实现dragAndDrop的三种方法中,我发现这种方法在量角器中是最合适的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59344143

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档