小编cse*_*pta的帖子

directConnect:true与在Protractor中的某个端口启动seleniumServer

我正在使用Protractor进行非角度应用的端到端测试.
一旦我用protractor.conf.js文件写了 -

exports.config = {
      directConnect: true,

      // Capabilities to be passed to the webdriver instance.
      capabilities: {
        'browserName': 'chrome'
      },

      // Framework to use. Jasmine is recommended.
      framework: 'jasmine',

      // Spec patterns are relative to the current working directory when
      // protractor is called.
      specs: ['example_spec.js'],

      // Options to be passed to Jasmine.
      jasmineNodeOpts: {
        defaultTimeoutInterval: 30000
      }
    };
Run Code Online (Sandbox Code Playgroud)

然后它适合我.
之后我做了一些改变,比如 -

exports.config = {
      seleniumAddress: 'http://localhost:4444/wd/hub',

      // Capabilities to be passed to the webdriver instance.
      capabilities: { …
Run Code Online (Sandbox Code Playgroud)

protractor

3
推荐指数
1
解决办法
8412
查看次数

在 Javascript 中将对象属性转换为逗号分隔值

在这里,我想将对象属性转换为逗号分隔的值,如下所示 - 将数组的元素连接到字符串中:

var fruits = {"f1":"Banana", "f2":"Orange", "f3":"Apple","f4":"Mango"};
var energy = Object.keys(fruits).map(function(k){return fruits[k]}).join(",");
Run Code Online (Sandbox Code Playgroud)

能量的结果将是:

Banana,Orange,Apple,Mango
Run Code Online (Sandbox Code Playgroud)

但是当我这样申请时-

 var fruits = {"f1":"Banana", "f2":"null", "f3":"Apple","f4":"Mango"};
 var energy = Object.keys(fruits).map(function(k){return fruits[k]}).join(",");
Run Code Online (Sandbox Code Playgroud)

能量的结果是这样的:

Banana,,Apple,Mango
Run Code Online (Sandbox Code Playgroud)

我想要这样的结果-

Banana,null,Apple,Mango
Run Code Online (Sandbox Code Playgroud)

我已经尝试过这些链接,但没有找到运气。

将 Javascript 对象的属性转换为逗号分隔列表的简单方法?

更新了问题

var fruits = {"f1":"Banana", "f2":"", "f3":"Apple","f4":"Mango"};
var energy = Object.keys(fruits).map(function(k){return fruits[k]}).join(",");
Run Code Online (Sandbox Code Playgroud)

能量的结果是这样的:

Banana,,Apple,Mango
Run Code Online (Sandbox Code Playgroud)

我想要这样的结果-

 Banana,null,Apple,Mango
Run Code Online (Sandbox Code Playgroud)

javascript

1
推荐指数
1
解决办法
4322
查看次数

标签 统计

javascript ×1

protractor ×1