ํ๊ฒฝ(๋ค์ ์ ๋ณด๋ฅผ ์์ฑํ์ญ์์ค):
WebdriverIO ๊ตฌ์ฑ
WebdriverIO ๊ตฌ์ฑ์ ๊ตฌ์ฑํ ๋ฐฉ๋ฒ์ ์
const path = require("path");
const isDebugMode = process.env.DEBUG === "true";
const chrome =
{
browserName: "chrome",
chromeOptions: {
args: ["--window-size=1366,768"]
}
};
var capabilities = [chrome];
if(process.env.RUNNING_IN_DOCKER)
{
capabilities =
[
{
browserName: "chrome",
chromeOptions: {
args: ["--headless", "--window-size=1366,768"]
}
}
// TO DO: Add headless Firefox see docker-compose.yml
];
} else if(process.env.ALL_BROWSERS)
{
capabilities =
[
chrome,
{
// set protected mode to the same value across all four zones in tools-> internet options -> security
// also make sure zoom level is 100%
browserName: "internet explorer"
}
];
}
exports.config = {
debug: isDebugMode,
execArgv: isDebugMode ? ['--inspect=9299'] : [],
sync: true,
maxInstances: 1,
//maxInstances: isDebugMode ? 1 : 10,
// Use selenium standalone server locally so we don't have a seperate selenium server in a seperate command prompt
// Use the selenium grid via docker on TC
services: process.env.RUNNING_IN_DOCKER ? [] : ["selenium-standalone"],
seleniumLogs: "./logs",
specs: [
"./features/**/*.feature"
],
exclude: [
"./features/**/topic-page.feature"
],
capabilities: capabilities,
logLevel: "verbose",
coloredLogs: true,
screenshotPath: "./errorShots/",
baseUrl: "https://*********/",
reporters: process.env.RUNNING_IN_DOCKER ? ["spec", "teamcity"] : ["spec"],
// Use BDD with Cucumber
framework: "cucumber",
cucumberOpts: {
compiler: ["js:babel-register"], // Babel so we can use ES6 in tests
require: [
"./steps/given.js",
"./steps/when.js",
"./steps/then.js"
],
tagExpression: "not @pending", // See https://docs.cucumber.io/tag-expressions/
timeout: 30000
},
// Set up global asssertion libraries
before: function before() {
const chai = require("chai");
global.expect = chai.expect;
global.assert = chai.assert;
global.should = chai.should();
},
}
๋ฒ๊ทธ ์ค๋ช
Chrome ๋ฐ ChromeDriver๋ฅผ ์
๊ทธ๋ ์ด๋ํ ํ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
Error: Promise was rejected with the following reason: unknown command: Cannot call non W3C standard command while in W3C mode
at elementIdDisplayed("e88a07f5-2ca3-42ad-b458-3d66797b37f0") - isVisible.js:71:55
ChromeDriver 75.0.3770.8 http://chromedriver.chromium.org/downloads ์ ๋ณ๊ฒฝ ์ฌํญ์ ๋ณด๋ฉด
"๊ฐ์ฅ ๋์ ๋๋ ๋ณ๊ฒฝ ์ฌํญ์ ์ด์ ChromeDriver๊ฐ ๊ธฐ๋ณธ์ ์ผ๋ก W3C ํ์ค ํธํ ๋ชจ๋์์ ์คํ๋๋ค๋ ๊ฒ์
๋๋ค."๋ผ๊ณ ์ธ๊ธ๋ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค.
ChromeOptions
w3c: false
๋ฅผ ์ง์ ํ์ฌ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์์ง๋ง ์ด๊ฒ์ด ์ฌ๋ฐ๋ฅธ ์ ๊ทผ ๋ฐฉ์์ด๋ผ๊ณ ์๊ฐํ์ง ์์ต๋๋ค. ์ด๋๊ฐ์ "๋น w3c ํ์ค" ๋ช
๋ น์ ํธ์ถํ๋ ๋ฌด์ธ๊ฐ๊ฐ ์๋ ๊ฒ ๊ฐ์ผ๋ฉฐ webdriverio์ ์ด๋๊ฐ์ ์๋ค๊ณ ๊ฐ์ ํฉ๋๋ค.
์ฌํํ๊ธฐ ์ํด
์์ ๋ด์ฉ์ผ๋ก ํ
์คํธ ํ๊ฒฝ์ ์ค์ ํ๊ณ npm test๋ฅผ ์คํํฉ๋๋ค.
์์๋๋ ํ๋
ํ
์คํธ๋ Cannot call non W3C standard command while in W3C mode
์ค๋ฅ ์์ด ์คํ๋์ด์ผ ํฉ๋๋ค.
์ด๊ฒ์ ํฌ๋กฌ์ ๋ฌธ์ ๊ฐ ์๋๋ผ ์ต์ ์ ์ง์ ํ๋ ๋ฐฉ๋ฒ์ ๋ฌธ์ ์ ๋๋ค. Chrome 75๋ ๊ธฐ๋ณธ์ ์ผ๋ก W3C์ ํธํ๋๋ฉฐ JSONWP๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด W3C๋ฅผ false๋ก ์ค์ ํด์ผ ํฉ๋๋ค(๋ฆด๋ฆฌ์ค ๋ ธํธ์ ์ธ๊ธ๋จ)
๋ค์๊ณผ ๊ฐ์ ์ต์ ์ ์ ๊ณตํ์ญ์์ค.
'goog:chromeOptions': {
'w3c': false,
args: ["--headless", "--window-size=1366,768"]
},
WebdriverIO ๋ฌธ์ ๊ฐ ์๋๋ผ ์ต์ ์ ์ ์ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋ฌธ์ ์ด๋ฏ๋ก ์ง๊ธ์ ๋ซ์ต๋๋ค.
@wwebcreation ๊ฐ์ฌํฉ๋๋ค. ๋ง์ต๋๋ค. W3C๋ฅผ false๋ก ์ค์ ํ๋ผ๋ ๋ฌธ๊ตฌ๋ฅผ ์ฐพ์ ์ ์๋ ๋ฆด๋ฆฌ์ค ๋ ธํธ๋ฅผ ์๋ ค ์ฃผ์๊ฒ ์ต๋๊น?
๊ฐ์ฌ ํด์
@wswebcreation ๊ทํ์ ์๊ฒฌ์ 100๋ฒ ์ถ์ฒํ ์ ์๋ค๋ฉด ๊ทธ๋ ๊ฒ ํ๊ฒ ์ต๋๋ค.
์ ๋ NightwatchJS์์ ์์ผ๋ฉฐ 2์ผ ๋์ ์ด ์ค๋ฅ๋ฅผ ์กฐ์ฌํด ์์ต๋๋ค. dockerized ์
๋ ๋ ํ๋ธ์์ ํค๋๋ฆฌ์ค chromedriver๋ฅผ ์คํํ๋ ค๊ณ ํ์ต๋๋ค. ๋ด nightwatch.json
ํ์ผ์ ํด๋น ์ค๋ํซ์ ์ถ๊ฐํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค. ๋ค๋ฅธ ์ฌ๋๋ค์ ์ํ ์ฐธ์กฐ๋ฅผ ์ํด ๋ด ํ์ผ์ ํด๋น ์น์
์ ์ด์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
"chromeOptions": {
"w3c": false,
"args": [
"--no-sandbox",
"--headless",
"--window-size=1920x1080"
]
}
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ด๊ฒ์ ํฌ๋กฌ์ ๋ฌธ์ ๊ฐ ์๋๋ผ ์ต์ ์ ์ง์ ํ๋ ๋ฐฉ๋ฒ์ ๋ฌธ์ ์ ๋๋ค. Chrome 75๋ ๊ธฐ๋ณธ์ ์ผ๋ก W3C์ ํธํ๋๋ฉฐ JSONWP๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด W3C๋ฅผ false๋ก ์ค์ ํด์ผ ํฉ๋๋ค(๋ฆด๋ฆฌ์ค ๋ ธํธ์ ์ธ๊ธ๋จ)
๋ค์๊ณผ ๊ฐ์ ์ต์ ์ ์ ๊ณตํ์ญ์์ค.
WebdriverIO ๋ฌธ์ ๊ฐ ์๋๋ผ ์ต์ ์ ์ ์ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋ฌธ์ ์ด๋ฏ๋ก ์ง๊ธ์ ๋ซ์ต๋๋ค.