์ฌ์ค, ๋ชจ๋ ๋ธ๋ผ์ฐ์ (ํนํ ํฌ๋กฌ์ด ์๋)์ ํ์ฅ ํ๋ก๊ทธ๋จ์ด ์ค์น๋ ํ์ด์ง๋ฅผ ์ด์ด์ผ ํฉ๋๋ค. ๋ฐ๋ผ์ ํ์ด์ดํญ์ค ๋๋ phantomjs๊ฐ ๋ ์ ์์ต๋๋ค(๊ฐ๋ฅํ์ง ํ์คํ์ง ์์).
๋ฐ๋ผ์ ํ์ฅ์๊ฐ ์ฌ์ ์ค์น๋ webdriverio๋ฅผ ํตํด chrome/firefox/phantom์ ์คํํ ์ ์๋ ๋ฐฉ๋ฒ์ด ์์ต๋๊น? ๊ทธ๋ ๋ค๋ฉด ์ด๋ป๊ฒ ํด์ผ ํฉ๋๊น?
๋ฏธ๋ฆฌ ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
๋ค ์์ต๋๋ค! ์ํ๋ ๊ธฐ๋ฅ์ chromeOptions
์์ฑ์ ๊ฐ์ง ์ ์์ต๋๋ค. ์ด ๊ฐ์ฒด์๋ crx
ํ์ผ์ base64 ๋ฌธ์์ด์ ์ฌ์ฉํ๋ extensions
๋ผ๋ ์์ฑ์ด ์์ต๋๋ค. ์์ธํ ์ ๋ณด๋ https://sites.google.com/a/chromium.org/chromedriver/capabilities์์ ์ฐพ์ ์
์, ์๋ํฉ๋๋ค
var data = await fs.readFileSync('./ext.zip');
options.desiredCapabilities.chromeOptions.extensions = [data.toString('base64')];
์ฌ๋ณด์ธ์! ์ ๊ทผ ๋ฐฉ์์ ๊ณต์ ํด ์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค!
@d668 ํ
์คํธ์ ํ์ฅ ๊ธฐ๋ฅ์ ์ถ๊ฐํ๋ ๋์ ๋น์ทํ ๋ฌธ์ ๊ฐ ์์
ํ์ฅ ํ๋ก๊ทธ๋จ์ ์ถ๊ฐํ๋ ค๊ณ ํ๊ณ ํ
์คํธ๋ฅผ ์คํํ ํ
์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
ERROR webdriver: Request failed due to unknown error: unknown error: cannot process extension #1 from unknown error: cannot read manifest
maxInstances: 5,
"goog:chromeOptions": {
extensions: [(function () {
try {
const webExt = fs.readFileSync('./extension.zip').toString('base64');
return webExt;
} catch (e) {
console.log(e, 'An error occurred while to parse extension zip file!');
}
})()],
args: ['--headless', '--disable-gpu']
},
@Madebyspeedster ํ์ฅ ํ๋ก๊ทธ๋จ์ ํฌ์ฅํด์ผ ํฉ๋๋ค. chrome://extensions๋ฅผ ์ด๊ณ https://github.com/Constellation/crxmake์ ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์, ์๋ํฉ๋๋ค