์ฐธ๊ณ
https://economytrendstory.com/1174
ํฌ๋กฌ ์๋ํ ํด selenium์ ํ์งํ๋ ๋ฒ 4๊ฐ์ง
selenium์ ํ์ง๊ฐ ๋ถ๊ฐ๋ฅ ํ ๊น์?์ด๋ค ๋ฐฉ์์ผ๋ก ์ ๋ ๋์์ ํ์ง ํ ์ ์์์ง ํ์ธํด๋ณด์์ต๋๋ค. navigator.webdriver ํ์ธClient hints, navigator.userAgentData ํ์ธchromedriver ํ์ง๋ธ๋ผ์ฐ์ ์ง๋ฌธ(browser fingerprin
economytrendstory.com
๋ฐฉ๋ฒ 1. ๊ฐ๋ฐ์ ๋๊ตฌ(F12)์์ "๊ธฐ๊ธฐ ํด๋ฐ ์ ํ" ์ฌ์ฉ
์์ ๊ธ์ ๋ณด๋ฉด navigator.userAgentData์์ ์๋ mobile, platform ๊ฐ์ ๊ฐ์ ๋ณ๊ฒฝํ๋ ๊ฒ ํ๋ค๋ค๊ณ ์ธ๊ธ์ ํ๋๋ฐ ์์ธ๋ก ์ฐํํ๋ ๋ฐฉ๋ฒ์ด ๊ฐ๋จํ๋ค. (๊ธฐ์กด์๋ mobile=false, platform='Windows'์ฒ๋ผ ๋์ด)
๋ง์ฝ navigator.userAgentData.mobile์ true๋ก navigator.userAgentData.platform์ 'Android'๋ก ์์ ํ๊ณ ์ถ๋ค๋ฉด
F12 ๊ฐ๋ฐ์ ๋๊ตฌ์์ ๊ฐ์ฅ ์ผ์ชฝ์์๋ ๋ ๋ฒ์งธ ๋ฒํผ "๊ธฐ๊ธฐ ํด๋ฐ ์ ํ"์ ๋๋ฅด๋ฉด ๋ชจ๋ฐ์ผ์ฒ๋ผ ๋ณด์ด๊ฒ ํ ์ ์๋ค.
๋ ์ข์ ๋ฐฉ๋ฒ์ ์ฝ๋๋ก ๋ฐ๊พธ๋ ๊ฑฐ์ง๋ง ๋ด๊ฐ ์๊ธฐ๋ก๋ ์ฝ๋๋ก navigator.userAgentData๋ฅผ ๋ฐ๊พธ๋ ๋ฐฉ๋ฒ์ ์๋ ๊ฒ์ผ๋ก ์๋๋ฐ, ๋ง์ฝ ํ์ํ๋ค๋ฉด ์์ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ๋ ์๋ฐ์ ์์์ง๋
๋ฐฉ๋ฒ 2. puppeteer ์ฌ์ฉํ๊ธฐ
puppeteer๋ ์ ๋ ๋์์ฒ๋ผ ํฌ๋ก๋ฏธ์์ ์ฌ์ฉํ๋ ์๋ํ ๋๊ตฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ธ๋ฐ ์ด๊ฑด ๋ navigator.userAgentData ์์ ์ด ์ ๋๋ค.
const page = await browser.newPage();
await page.setUserAgent('MyBrowser', {
architecture: 'My1',
mobile: false,
model: 'Mybook',
platform: 'MyOS',
platformVersion: '3.1',
});
์ถ์ฒ:
How to overwrite the User-Agent Client Hints in puppeteer?
I am facing an issue with dealing with the user-agent-client-hints. If you have no idea what User-agent-client-hints are then think of them as some request headers. (See the image below) I tried to
stackoverflow.com
'๐จ๐ผโ๐ป๊ฐ๋ฐ > ์ ๋ ๋์' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
์ ๋ ๋์ - ์ํฐ๋ด ํ์ธ ์ฌ์ดํธ (0) | 2022.10.12 |
---|---|
์ ๋ ๋์ - ํน์ URL ์ฐจ๋จํ๊ธฐ (0) | 2022.10.11 |
์ ๋ ๋์ - ๋ค์ด๋ฒ๊ฐ ์ ๋ ๋์์ ํ์งํ๋ ๋ฐฉ๋ฒ (0) | 2022.09.27 |
์ ๋ ๋์ - Element is not clickable at point ํด๊ฒฐ ๋ฐฉ๋ฒ (0) | 2022.08.31 |
์ ๋ ๋์ - ๋ง์ฐ์ค๋ฅผ ๋ ์ธ๊ฐ์ ์ผ๋ก ์กฐ์ํ๊ธฐ(Action ํด๋์ค) (0) | 2022.07.26 |