Why Do I get agent and profile data on address bar ? I tried with webdriver and there are no issue with it
def new_agent():
agent_str = [
"Mozilla/6.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 "
"Safari/537.36",
"Mozilla/6.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 "
"Safari/537.36",
"Mozilla/6.0 (Macintosh; Intel Mac OS X 10_10) AppleWebKit/600.1.25 (KHTML, like Gecko) Version/8.0 "
"Safari/600.1.25",
return random.choice(agent_str)
def __init__(self):
opts = uc.ChromeOptions()
opts.add_argument("--disable-blink-features=AutomationControlled")
opts.add_argument('--profile-directory=Profile 1')
opts.add_argument('user-data-dir=/home/sun/.config/google-chrome/')
opts.add_argument("--ignore-certificate-errors")
opts.add_argument(f"user-agent={new_agent()}")
self.driver = uc.Chrome(service=Service(ChromeDriverManager().install()), options=opts)
self.driver.get("https://example.com") #any link
I misspelled the "user-data-dir" and "user-agent" options. Replaced with "--user-data-dir" , "--user-agent" ...