I'm learning Scraping with python + selenium.
Wish
I want to login google and chrome when I use selenium. and popele say It's detecting a automation mode for bot detection. So you should hide you are using selenium.
That's why I wrote this code.
Here is my code
import time
from selenium import webdriver
from selenium.webdriver.support.select import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from requests.exceptions import Timeout
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
options.add_argument('--window-size=1280,800')
options.add_argument('--user-data-dir=/Users/username/Library/Application Support/Google/Chrome/')
options.add_argument('--profile-directory=Profile 3')
options.add_argument('--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.67 Safari/537.36')
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_experimental_option("excludeSwitches", ['enable-automation'])
driver = webdriver.Chrome("selenium/chromedriver", options=options)
driver.get('https://www.google.co.jp/')
time.sleep(1000)
My user profile is not working. When using selenium, It doesn't show me as signed in.
chrome://version
Tried answering code
I got this error
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: cannot parse capability: goog:chromeOptions
from invalid argument: unrecognized chrome option: excludeSwitches
Changed My code
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.select import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from requests.exceptions import Timeout
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
options.add_argument('--window-size=1280,800')
options.add_argument('--user-data-dir=/Users/wakasugiwataru/Library/Application Support/Google/Chrome/')
options.add_argument('--profile-directory=Profile 3')
options.add_experimental_option("debuggerAddress", "127.0.0.1:1557")
options.add_argument('--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.67 Safari/537.36')
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_experimental_option("excludeSwitches", ['enable-automation'])
driver = webdriver.Chrome("selenium/chromedriver", options=options)
driver.get('https://www.google.co.jp/')
time.sleep(1000)


