Last active
February 1, 2024 01:21
-
-
Save omisolaidowu/506766ff5484d1bbb8fd8aaebb8d9dc3 to your computer and use it in GitHub Desktop.
Initial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import the required libraries | |
const { Builder } = require('selenium-webdriver'); | |
const chrome = require('selenium-webdriver/chrome'); | |
// set the path to udetected_chromedriver executable file | |
const chromeDriverPath = 'C:/Users/dell/AppData/Roaming/undetected_chromedriver/undetected_chromedriver.exe'; | |
// set the path to your actual Chrome browser executable file | |
const chromeExePath = 'C:/Program Files/Google/Chrome/Application/chrome.exe'; | |
// specify custom user agent | |
const customUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'; | |
// set Chrome options | |
const chromeOptions = new chrome.Options(); | |
chromeOptions.setChromeBinaryPath(chromeExePath); | |
// add the custom user agent | |
chromeOptions.addArguments(`user-agent=${customUserAgent}`); | |
// run Chrome in headless mode | |
chromeOptions.addArguments('--headless'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment