Selenium-Webdriver NodeJS相当于Java代码的DesiredCapabilities

我已经在selenium-webdriver位于这里( http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_Capabilities.html )search文档(这里没有什么) 我找不到从Java到NodeJS的等效代码。 这里是JAVA中的代码(我从这里复制testingconfiguration选项部分, https://github.com/zalando/zalenium/blob/master/docs/usage_examples.md#initial-setup ) DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); desiredCapabilities.setCapability(CapabilityType.BROWSER_NAME, BrowserType.FIREFOX); desiredCapabilities.setCapability(CapabilityType.PLATFORM, Platform.LINUX); desiredCapabilities.setCapability("name", "myTestName"); 特别是我想设置能力“名称”,所以我可以用Zalenium命名我的testing。 我如何在NodeJS中做到这一点? 这是我目前的selnium webdriver代码,它的工作(和编辑删除敏感信息),但不设置testing名称。 我试过这个.withCapabilities(webdriver.Capabilities.chrome(),{“name”,“chrometest”}),它编译,但我不认为它做什么? //Run using this project (https://github.com/qmu/dockerfiles/blob/master/src/selenium-webdriver-node/example/bin/run) "use strict"; const webdriver = require('selenium-webdriver'), By = webdriver.By, until = webdriver.until, test = require('selenium-webdriver/testing'); //const expect = require('expect.js'); const assert = require('assert'); var driver = new […]

在Neo4j中根据Where条件插入数据

我想插入基于其他lebel/collection 。 我有2个lebel/collection ( 单元,用户 ),他们之间有1个关系( Business ),我想根据他们的关系将数据插入到unit 。 我的密码查询如下: MATCH (u:Units)<-[:Business]-(s:Users) WHERE s.id = 'some-user-id' WITH count(u) as numOfUnit // return number of units connected with user // if numOfUnit is smaller then 2 // insert/merge new data into Units lebel/collection // with relation between them MERGE ( bu:Units {name:'some-name-01', info:'some-info-01' }) WHERE numOfUnit […]

获取“ENOTEMPTY:目录不空,rmdir …”在angularCLI应用程序中安装express的错误。

我正在创build我的第一个MEAN应用程序。 我已经安装了angularCLI,也使用ng serve -otesting它 – 这个命令,然后我使用ng build应用程序也成功。 现在,当我试图安装“express”和“body-parser”时,我正在收到以下错误 ENOTEMPTY: directory not empty, rmdir '/media/iconflux/DATA/vinit/Mean/meanApp/node_modules/fsevents/node_modules/dashdash/node_modules/assert-plus' 我检查了它是空的目录。 我也尝试手动删除目录,但仍然没有成功。 这里是我用来安装express和body-parser的命令 npm install –save express body-parser 注意:我正在使用Ubuntu 14.0 任何帮助将不胜感激。

找不到与给定名称匹配的资源:attr'android:keyboardNavigationCluster'

当我尝试使用ionic cordova run android –prod时,我目前在我的Ionic项目中遇到这个奇怪的错误。 我尝试删除和读取平台,删除和读取节点模块,切换npm和节点版本无济于事。 问:有没有人有任何想法如何解决这个神秘的问题? C:\…\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'. FAILED BUILD FAILED Total time: 26.595 secs FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt * Try: Run with –stacktrace option to […]

节点JS – UnhandledPromiseRejectionWarning

我正在使用Node和MongoDB来创build一个团队分组,并遇到节点控制台错误: UnhandledPromiseRejectionWarning:未处理的承诺拒绝(拒绝ID:2):TypeError:无法读取undefined属性'apply'undefined 我正在使用Axios发布一个请求到我的NodeJS API,应该在我的MongoDB中创build一个新的条目。 这是我的代码: 控制器: const mongoose = require('mongoose'); const Team = mongoose.model('Team'); const promisify = require('es6-promisify'); exports.validateTeamName = (req,res,next) => { req.sanitizeBody('teamName'); req.checkBody('teamName','You must supply a name!').notEmpty(); req.sanitizeBody('userId'); req.checkBody('userId','There was an error with your user id – please log out and log back in!').notEmpty(); const errors = req.validationErrors(); if(errors) { req.flash('error',errors.map(err => err.msg)); […]

请求默认值,使用一个函数作为默认头

在使用NPM请求模块的request.defaults API时,是否有人知道我可以将一个函数作为请求头传递,以便每次发出请求时函数的结果都会变成标头值? 即 request.defaults({ headers:{datestamp:() => new Date() })

JavaScript链接列表:方法removeHead()和contains()不起作用

使用ES6风格,任务是build立一个链表,并通过npm lintertesting。 这是我写的代码: class LinkedList { constructor() { this.head = null; this.tail = null; // Do not modify anything inside of the constructor } // Wraps the given value in a node object and adds the node to the tail of the list // If the list is empty, the new element is considered the […]

Bot将string返回给我没有指定的数字

做一个不和谐的机器人。 获得“你赢”不仅是6卷,而是2和4。 我知道这不是最好的办法。 它似乎并不在乎如果随机=='插入string在这里'或随机=='插入int在这里'。 //Dice Roll Game bot.on('message', (message) =>{ let diceNum = ['1','2','3','4','5','6']; let random = diceNum[Math.floor(Math.random() * diceNum.length)]; if(message.content == '!roll') { message.reply('You rolled a' + ' ' + random + '!'); } if(random == 6){ message.reply('You win!'); } });

需要帮助相关的asynchronous函数执行stream程(await,promises,node.js)

如果你帮我解决以下情况,我将不胜感激。 给定function: async function getAllProductsData() { try { allProductsInfo = await getDataFromUri(cpCampaignsLink); allProductsInfo = await getCpCampaignsIdsAndNamesData(allProductsInfo); await Promise.all(allProductsInfo.map(async (item) => { item.images = await getProductsOfCampaign(item.id); })); allProductsInfo = JSON.stringify(allProductsInfo); console.log(allProductsInfo); return allProductsInfo; } catch(err) { handleErr(err); } } 这个函数在服务器启动时被触发,它收集来自其他站点的活动信息:获取数据(getDataFromUri()),然后从数据名称和id(getCpCampaignsIdsAndNamesData())中提取,然后获取每个活动的产品图像(getProductsOfCampaign()) ; 我也express.app与下面的一段代码: app.get('/products', async (req, res) => { if (allProductsInfo.length === undefined) { console.log('Pending…'); allProductsInfo = […]

将一组函数asynchronous传递给一个数组

所以我有一个四个JSON对象的数组,我想添加三个新的字段到这些对象的每一个。 要做到这一点,我有一个asynchronous函数添加每个新的字段。 理想情况下,我想要做的就是将asynchronous函数限制为只有两个更新。 然后在最后callback原始函数并打印出新形成的数组。 但我不能得到这个工作,虽然我觉得我很接近… var async = require('async'); // My Array of JSON objects var allIssues = [ { id: '1', color: 'blue' }, { id: '2', color: 'red' }, { id: '3', color: 'gold' } ]; addExtraFeaturesToEachissue(allIssues, function(data) { console.log(data); }); function addExtraFeaturesToEachissue(allIssues, callback) { async.each( allIssues, async.applyEach([addheight, addWidth, addWeight]), callback(data) ); } […]