I use selenium with chromedriver to login apple connect website on ubuntu 20.04 and chrome version 99.0.4844.51
The login page is easy to handle but next it detect the new browser and require device verify code. I think maybe I type once then it won't require but I was wrong.
It still require verifying when I trigger the python script. Is there possible the server location is different with my device? The server is at USA and I'm in Asia.
I found that argument 'profile-directory' is not create the specific directory in chrome-data!
I try the following solution but not working.
def main():
ua = UserAgent()
userAgent = ua.google
opts = Options()
opts.add_argument('user-agent={userAgent}')
opts.add_argument("user-data-dir=/home/jack/crawler/chrome-data")
opts.add_argument('profile-directory=Profile3')
driver = webdriver.Chrome(options=opts)
driver.get("https://appstoreconnect.apple.com/")
You can follow this post to create a custom profile.
How to open a Chrome Profile through --user-data-dir argument of Selenium
If you are using ubuntu you can do this:
opts = Options()
opts.add_argument("--user-data-dir=/home/yuyu/.config/google-chrome")
opts.add_argument("--profile-directory=Profile 1")
It worked for me to let website remember the browser