简体   繁体   中英

Retrieve 2FA form paypal on selenium python

i have try to pay with paypal with selenium, so i have this:

    password = browser.find_element_by_xpath("//input[@id='password']")
    password.send_keys("password")
    element = browser.find_element_by_xpath("//button[@id='btnLogin']")
    action = ActionChains(browser)
    action.click(on_element = element)
    action.perform()

but after i have a issue i have to retrieve the 2FA code from an authentificator app and i don't know how to do this, i'm on mac. Is there a solution? Thanks

I have found a solution it's to create this function

def top():
key = "XXXXXXXXX"
totp = TOTP(key)
token = totp.now()
return token

and after you set this for paypal with selenium

password = browser.find_element_by_xpath("//input[@id='otpCode']")
            password.send_keys(top())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM