小编Mát*_*nka的帖子

Selenium和ChromeDriver:未创建会话,无法连接到渲染器

我试图通过Mac上的Webdriver.io,Selenium和ChromeDriver运行自动化测试.我正在使用所有相关软件的最新版本:

  • 硒3.9.1
  • ChromeDriver 2.35
  • Chrome 64
  • 操作系统:macOS High Sierra 10.13.3

当我尝试从CLI运行wdio时,我得到以下输出:

$ ./node_modules/.bin/wdio --spec ./test_js/specs/features/aggregated/dataAccessControl.feature.js

----------
selenium-standalone installation starting
----------

---
selenium install:
from: https://selenium-release.storage.googleapis.com/3.9/selenium-server-standalone-3.9.1.jar
to: /PROJECT_PATH/node_modules/selenium-standalone/.selenium/selenium-server/3.9.1-server.jar
---
chrome install:
from: https://chromedriver.storage.googleapis.com/2.35/chromedriver_mac64.zip
to: /PROJECT_PATH/node_modules/selenium-standalone/.selenium/chromedriver/2.35-x64-chromedriver
---
File from https://selenium-release.storage.googleapis.com/3.9/selenium-server-standalone-3.9.1.jar has already been downloaded
---
File from https://chromedriver.storage.googleapis.com/2.35/chromedriver_mac64.zip has already been downloaded


-----
selenium-standalone installation finished
-----
A service failed in the 'onPrepare' hook
Error: Unable to connect to selenium
    at Timeout.hasStarted [as _onTimeout] (/PROJECT_PATH/node_modules/selenium-standalone/lib/check-started.js:17:10)
    at ontimeout (timers.js:475:11)
    at tryOnTimeout (timers.js:310:5)
    at …
Run Code Online (Sandbox Code Playgroud)

selenium selenium-chromedriver selenium-webdriver

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

重构求解javascript中的算法

我参加了一家开发公司的技术面试.他们问了我以下几点:

给出一组数字(n)找到2个数和,给出(k)并打印它们.
例如

Input: n = [2,6,4,5,7,1], k = 8   
Output: result=(2,6),(7,1)   
Run Code Online (Sandbox Code Playgroud)

我的解决方案

function findSum(n,k){
    let aux = []
    for (let i = 0; i < n.length; i++) {
        for (let j = i+1; j < n.length; j++) {
            if (n[i] + n[j] == k) {
                aux.push({ first: n[i], second: n[j] })
            }
        }
    }
    return aux;
}
Run Code Online (Sandbox Code Playgroud)

他们告诉我,可以通过某种键或映射来进行练习.
有人知道如何只用一个循环吗?

javascript arrays sorting algorithm

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