微软边缘和守夜人

时间:2016-09-08 19:31:57

标签: selenium microsoft-edge nightwatch.js

出于某种原因,我无法在Microsoft Edge Windows 10中进行测试。

这是我的夜班配置

"edge": {
            "use_ssl": false,
            "silent": true,
            "output": true,
            "desiredCapabilities": {
                "browserName": "MicrosoftEdge",
                "platform": "Windows 10",
                "version": "13.10586",
                "screenResolution": "1280x1024",
                "avoidProxy": true
            }
}

有没有人能够在Microsoft Edge中使用他们的测试? 如果是这样,你使用什么版本的硒?我用2.52 你使用什么版本的边缘驱动程序?

3 个答案:

答案 0 :(得分:0)

首先,您需要Microsoft Edge Webdriver。您可以从这里下载:https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

然后在nigthwatch.js配置中,您需要指定边缘webdriver(webdriver.edge.driver arg)的路径。这是我的配置的样子: "selenium": { "start_process": true, "server_path": "./node_modules/file_dependencies/selenium-server-standalone.jar", "log_path": "", "host": "127.0.0.1", "port": seleniumPort, "cli_args": { "webdriver.chrome.driver": "./node_modules/file_dependencies/chromedriver.exe", "webdriver.ie.driver": "./node_modules/file_dependencies/IEDriverServer.exe", "webdriver.edge.driver": "C:/Program Files (x86)/Microsoft Web Driver/MicrosoftWebDriver.exe", "webdriver.gecko.driver": "./node_modules/file_dependencies/geckodriver.exe", "webdriver.firefox.profile": "" } }

其他配置看起来很好

答案 1 :(得分:0)

我在使用Selenium 3.9.1时无法获得优势,因为Selenium试图使用geckodriver对Edge进行测试。

我的配置如下所示(片段保持重点):

"selenium" : {
    "cli_args" : {
      "webdriver.chrome.driver" : "bin\\chromedriver.exe",
      "webdriver.edge.driver" : "bin\\MicrosoftWebDriver.exe",
      "webdriver.gecko.driver" : "bin\\geckodriver.exe",
      "webdriver.firefox.profile": ""
    }
},

"test_settings" : {
    "default" : {
      "desiredCapabilities": {
        "browserName": "edge",
        "marionette": true
        }   
    }
}

通过将“ edge”更改为“ ie”,将浏览器名称更改为“ internet Explorer”,我可以解决此问题-查看更新后的配置:

"selenium" : {
    "cli_args" : {
        "webdriver.chrome.driver" : "bin\\chromedriver.exe",
        "webdriver.ie.driver" : "bin\\MicrosoftWebDriver.exe",
        "webdriver.gecko.driver" : "bin\\geckodriver.exe",
        "webdriver.firefox.profile": ""
    }
},

"test_settings" : {
    "default" : {
        "launch_url" : "http://localhost",
        "selenium_port"  : 4444,
        "selenium_host"  : "localhost",
        "silent": true,
        "screenshots" : {
            "enabled" : false,
            "path" : ""
        },
        "desiredCapabilities": {
            "browserName": "internet explorer",
            "marionette": true
        }
    }
}

答案 2 :(得分:0)

自动生成的 nightwatch.conf.js 已包含 Edge 浏览器的配置,因此您只需标记 edge 环境即可运行:

nightwatch --env edge