- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use a specific chrome profile in selenium?
We can use a specific Chrome profile in Selenium. This can be done with the help of the ChromeOptions class. We need to create an object of this class and then apply addArguments method on it.
The path of the specific Chrome profile that we want to use is passed as a parameter to this method. We can open Chrome’s default profile with Selenium. To get the Chrome profile path, we need to input chrome://version/ in the Chrome browser and then press enter.
Syntax
o = webdriver.ChromeOptions() o.add_argument = {'user-data-dir':'/Users/Application/Chrome/Default'}
Example
Code Implementation
from selenium import webdriver #object of ChromeOptions class o = webdriver.ChromeOptions() #adding specific Chrome Profile Path o.add_arguments = {'user-data-dir':'<path of specific Chrome profile>'} #set chromedriver.exe path driver = webdriver.Chrome(executable_path="C:\chromedriver.exe", options=o) #maximize browser driver.maximize_window() #launch URL driver.get("https://www.tutorialspoint.com/index.htm") #get browser title print(driver.title) #close browser driver.close()
Output
- Related Articles
- How to open chrome default profile with selenium?
- How to use chrome webdriver in Selenium to download files in Python?
- How to handle chrome notification in Selenium?
- How to stop a page loading from Selenium in chrome?
- How to launch Chrome Browser via Selenium?
- How to run Selenium WebDriver test cases in Chrome?
- How to use selenium to check if element contains specific class attribute?
- How to invoke the Chrome browser in Selenium with python?
- How to mute all sounds in chrome webdriver with selenium?
- How to set default download directory in selenium Chrome Capabilities?
- How do I open Chrome in selenium WebDriver?
- How to programmatically configure Chrome extension through Selenium WebDriver?
- How to run Selenium tests on Chrome Browser using?
- How to setup Chrome driver with Selenium on MacOS?
- How to save as PDF on Chrome using Selenium

Advertisements