-
-
Save ikegami-yukino/51b247080976cb41fe93 to your computer and use it in GitHub Desktop.
mail_address = '' | |
password = '' | |
from selenium import webdriver | |
UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0' | |
PHANTOMJS_ARG = {'phantomjs.page.settings.userAgent': UA} | |
driver = webdriver.PhantomJS(desired_capabilities=PHANTOMJS_ARG) | |
url = 'https://www.google.com/accounts/Login?hl=ja&continue=http://www.google.co.jp/' | |
driver.get(url) | |
driver.find_element_by_id("Email").send_keys(mail_address) | |
driver.find_element_by_id("next").click() | |
driver.find_element_by_id("Passwd").send_keys(password) | |
driver.find_element_by_id("signIn").click() |
its been more than a month but if you still, for whatever reason, need to contact me, you can do so on discord with the tag hello215
@Fakesum Does this method only work locally? I am trying to standup some tests on jenkins but after entering the password this way, I'm then redirected to
https://accounts.google.com/v3/signin/challenge/iap
and cannot complete the auth flow.
works well locally though
EDIT:https://accounts.google.com/v3/signin/challenge/iap
is a 2FA challenge for accounts that don't have 2FA enabled, to set it up in-line. Likely will need to forward proxy and that potentially won't help either.This works locally for me, it does give me a warning of suspicious activity but thats after logging in. try changing the url to "https://accounts.google.com/signin" since this will redirect to oauth v3 login screen instead of the old oauth v2 one.
hey bro, can i contact you somewhere else? i really need your help
Its been more than a month, but if you still need to contant me, you can do so on hello215
on discord
its been more than a month but if you still, for whatever reason, need to contact me, you can do so on discord with the tag
hello215
@Fakesum Does this method only work locally? I am trying to standup some tests on jenkins but after entering the password this way, I'm then redirected to
https://accounts.google.com/v3/signin/challenge/iap
and cannot complete the auth flow.
works well locally though
EDIT:https://accounts.google.com/v3/signin/challenge/iap
is a 2FA challenge for accounts that don't have 2FA enabled, to set it up in-line. Likely will need to forward proxy and that potentially won't help either.This works locally for me, it does give me a warning of suspicious activity but thats after logging in. try changing the url to "https://accounts.google.com/signin" since this will redirect to oauth v3 login screen instead of the old oauth v2 one.
hey bro, can i contact you somewhere else? i really need your help
Its been more than a month, but if you still need to contant me, you can do so on
hello215
on discord
Hi Guy. You can help me login google with python?
I have added your discord account. Thank bro
from seleniumwire import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
import time
import random
Paths and credentials
firefox_binary_path = r'C:\Program Files\Mozilla Firefox\firefox.exe'
profile_path = r'C:\Users\tec-d\AppData\Roaming\Mozilla\Firefox\Profiles\c6rj509q.default-release'
your_email = '@gmail.com'
your_password = ''
Proxy settings
proxies = [
"......",
]
proxy = random.choice(proxies)
proxy_host, proxy_port, proxy_username, proxy_password = proxy.split(':')
proxy_options = {
'proxy': {
'http': f'http://{proxy_username}:{proxy_password}@{proxy_host}:{proxy_port}',
'https': f'https://{proxy_username}:{proxy_password}@{proxy_host}:{proxy_port}',
'no_proxy': 'localhost,127.0.0.1'
}
}
Firefox options
FF_OPTIONS = [
'--no-sandbox',
'--start-maximized',
'--start-fullscreen',
'--single-process',
'--disable-dev-shm-usage',
'--incognito',
'--disable-blink-features=AutomationControlled',
'--disable-xss-auditor',
'--disable-web-security',
'--ignore-certificate-errors',
'--disable-notifications',
'--disable-infobars',
'--disable-extensions',
'--useAutomationExtension=False',
'--excludeSwitches=enable-automation',
]
Firefox profile preferences
SET_PREF = {
'general.useragent.override': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
'permissions.default.desktop-notification': 1,
'dom.webnotifications.enabled': 1,
'dom.push.enabled': 1,
'intl.accept_languages': 'en-US',
'network.proxy.type': 1,
'network.proxy.http': proxy_host,
'network.proxy.http_port': int(proxy_port),
'network.proxy.ssl': proxy_host,
'network.proxy.ssl_port': int(proxy_port),
'network.proxy.socks_username': proxy_username,
'network.proxy.socks_password': proxy_password,
'media.peerconnection.enabled': False,
'network.cookie.cookieBehavior': 0,
'network.cookie.lifetimePolicy': 0,
}
options = webdriver.FirefoxOptions()
options.binary_location = firefox_binary_path
options.add_argument(f'--profile={profile_path}')
for option in FF_OPTIONS:
options.add_argument(option)
browser = webdriver.Firefox(seleniumwire_options=proxy_options, options=options)
email_field = WebDriverWait(browser, 40).until(EC.presence_of_element_located((By.ID, 'identifierId')))
email_field.send_keys(your_email)
email_field.send_keys(Keys.ENTER)
time.sleep(random.uniform(3, 6))
email_field = WebDriverWait(browser, 40).until(EC.presence_of_element_located((By.ID, 'identifierId')))
email_field.send_keys(your_email)
email_field.send_keys(Keys.ENTER)
time.sleep(random.uniform(3, 6))
password_field = WebDriverWait(browser, 20).until(EC.presence_of_element_located((By.NAME, 'password')))
password_field.send_keys(your_password)
password_field.send_keys(Keys.ENTER)
WebDriverWait(browser, 30).until(EC.title_contains('Inbox'))
except Exception as e:
print(f"An error occurred: {e}")
finally:
browser.quit() la meme probleme reste pour moi que conexion non securises mon besoin browser firefox
Hi bro. I 'am from VN. Can you help me automation login google