This question already has answers here:
How to open a Chrome Profile through Python
(2 answers)
How to use Chrome Profile in Selenium Webdriver Python 3
(12 answers)
How to open the Default Chrome Profile through Selenium, ChromeDriver and GoogleChrome
(4 answers)
Closed 2 years ago.
I have a chrome profile (called Profile 1) which I would like to control with Selenium. Whenever I try to open that chrome profile, Chrome opens without my profile, like it was my very first time opening Chrome.
My code is the following:
options = Options()
options.add_argument("user-data-dir=C:\\Users\\Ákos\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 1")
driver = webdriver.Chrome(executable_path="C:\\pythonScriptjeim\\chromedriver.exe", options=options,)
driver.get("https://www.google.com/")
Funny thing is if i delete Profile 1 from the end like this, Chrome opens with my default profile:
options.add_argument("user-data-dir=C:\\Users\\Ákos\\AppData\\Local\\Google\\Chrome\\User Data")
So my problem is, that anything written after User Data doesn't seem to have any effects on chrome.
Any suggestions on how I could open the profile i'd like to control?
Related
This question already has answers here:
How to get rid of the infobar "Chrome is being controlled by automated test software" through Selenium
(4 answers)
Unable to hide "Chrome is being controlled by automated software" infobar within Chrome v76
(8 answers)
Closed 2 years ago.
I am a beginner with Selenium. I can not seem to disable the "AutomationControlled" flag in Chrome. according to this article: https://piprogramming.org/articles/How-to-make-Selenium-undetectable-and-stealth--7-Ways-to-hide-your-Bot-Automation-from-Detection-0000000017.html#:~:text=%207%20Ways%20to%20hide%20your%20Bot%20Automation,you%20if%20you%20are%20using%20Linux...%20More%20, there are 2 main ways of doing this. One of them can be done before instantiating the driver so that not even Chrome knows that is is being controlled by Selenium. This is the one I am interested in, but I can not get it to work.
Here is what I have:
from selenium import webdriver
option = webdriver.ChromeOptions()
option.add_argument('--disable-blink-features=AutomationControlled')
browser = webdriver.Chrome(executable_path='chromedriver.exe',options=option)
I dont get any errors with this but Chrome sure knows it is being controlled by Selenium bc the banner shows along the top of the browser. I have tried to confirm if the flag AutomationControlled is set but I cannot find where I can check this. I am running Chromedriver 87. something.
Any help is appreciated.
This question already has an answer here:
How to download XML files avoiding the popup This type of file may harm your computer through ChromeDriver and Chrome using Selenium in Python
(1 answer)
Closed 3 years ago.
I am trying to download files from website using selenium and chrome webdriver in python and i am getting the alert to keep or discard. I have tried every way as mentioned on stackoverflow to change the chrome option and preferences, but of no use.
Thanks in Advance
Have you tried this?
chromeOptions = webdriver.ChromeOptions()
prefs = {'safebrowsing.enabled': 'false'}
chromeOptions.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(chrome_options=chromeOptions)
This question already has an answer here:
Selenium Webdriver with Python - driver.title parameter
(1 answer)
Closed 4 years ago.
I am successfully opening a url using selenium and python. Above the address bar in the browser there is a tab that gets opened, I am trying to get the name that tab displays.
For e.g. I opened the url - https://8.8.8.8
After it is opened, tab name appears as Google.
I am trying to fetch the name of the tab i.e google.
Simply call driver.title. See below:
from selenium import webdriver
d = webdriver.Chrome()
d.get('https://python.org')
d.title
# 'Welcome to Python.org'
This question already has answers here:
Python: Unable to download with selenium in webpage
(5 answers)
Closed 4 years ago.
Using geckodriver and Firefox v63, I try to download a CSV file from a website without causing the download prompt to appear.
My code is:
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList', 2) # custom location
profile.set_preference('browser.download.manager.showWhenStarting', False)
profile.set_preference('browser.download.dir', '/Path/to/download')
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'text/csv')
browser = webdriver.Firefox(profile, options=options)
browser.get('http://www.website.com')
download = browser.find_element_by_css_selector('selector')
download.click()
It does not work and I don't understand why. I don't get an error and the code executes, but it shows the Firefox download window and only safes the file if I click OK. I'd like to avoid clicking manually because I want to automate the task.
Open up FireFox and try this
Goto Preferences -> General
and then pick the folder you want to download to and uncheck the "always ask"
Give this a shot, good luck!
This question already has answers here:
Python / Selenium / Firefox: Can't start firefox with specified profile path
(2 answers)
Closed 7 years ago.
So I've been experimenting with a custom firefox profile in my selenium project so that websites don't think I'm a new user every time. This is the code I'm using:
profile FirefoxProfile('C:\\Users\\Scott\\AppData\\Local\\Mozilla\\Firefox\\Profiles\\t3bxt79j.bot_profile')
binary = FirefoxBinary('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe')
browser = webdriver.Firefox(firefox_profile=profile, firefox_binary=binary)
This code should link up to my profile that I created and the binary (which is already tested and working). However, every time I go to the website it acts like I'm a new user. None of my bookmarks on this profile are saving either and I'm making sure that I load firefox with the new profile.
It does save, but does not get back to you.
I've answered that just now here: https://stackoverflow.com/a/33350778/2480481.
Profile is made to allow you run test with certain personalization of the firefox, settings, extensions, etc, not for save it.
But yes, I miss too a parameter to make it "fixed" instead of temporal.