Home > Software engineering >  Using selenium to login apple connect always need verify
Using selenium to login apple connect always need verify

Time:03-08

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.

  • save cookies when login success first time and reload cookies next time
  • add userAgent
  • add custom profile location
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/")

CodePudding user response:

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:

  1. Trying to use remote desktop to connect your ubuntu. (xrdp or others)
  2. Open google chrome and create a profile
  3. type chrome://version to check the profile path
  4. Fill the path and profile name
    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

  • Related