'Using selenium to login apple connect always need verify

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/")


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source