错误:使用Eclipse在量角器中找不到模块'C:\ Users \ username \ Documents \ Eclipse'

时间:2019-08-24 18:13:38

标签: protractor

要运行Simple Protractor程序(打开Goog​​le并搜索关键字),当我通过cmd运行但遇到“错误:找不到模块'C:\ Users \ username \ Documents \ Eclipse'”问题时,该程序运行正常我尝试使用Eclipse运行相同的程序

下面是执行的步骤。 1.在Eclipse中创建JavaScript项目 2.将spec.js和conf.js复制到项目中 3.将项目转换为Tern项目 4.从项目位置运行“ npm安装量角器” 5.从运行配置中选择cli.js 6.运行conf.js,结果为“错误:找不到模块'C:\ Users \ username \ Documents \ Eclipse'”

下面是conf.js和spec.js的代码

conf.js:

exports.config = {
        specs: ['spec.js'],
        capabilities: {
            browserName: 'chrome',
            chromeOptions: {
                // disable "chrome pop-up"
                'args': ['disable-infobars=true'], 

                // disable Password manager popup
                'prefs': {
                    'credentials_enable_service': false
                }
            }
        }


}

spec.js

describe('Open Google and search for Protractor', function(){
    it('It should open Google and search for Protractor', function(){
        browser.waitForAngularEnabled(false);
        browser.driver.manage().window().maximize();
        browser.get('https://google.co.in');
        browser.sleep(3000);
        var search=element(by.name('q'));
        search.sendKeys('Protractor'+protractor.Key.ENTER);
        browser.sleep(3000);

    });


});

错误:

module.js:340
    throw err;
    ^

Error: Cannot find module 'C:\Users\username\Documents\Eclipse'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:289:25)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:136:18)
    at node.js:963:3

期望当我从Eclipse运行conf.js时,应打开浏览器并搜索“量角器”关键字

0 个答案:

没有答案