简体   繁体   English

在 selenium python 上检索 2FA 表格 paypal

[英]Retrieve 2FA form paypal on selenium python

i have try to pay with paypal with selenium, so i have this:我尝试用 selenium 用 paypal 付款,所以我有这个:

    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.但是在我遇到问题后,我必须从身份验证器应用程序中检索 2FA 代码,但我不知道该怎么做,我在 Mac 上。 Is there a solution?有解决办法吗? Thanks谢谢

I have found a solution it's to create this function我找到了一个解决方案来创建这个 function

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

and after you set this for paypal with selenium在你用 selenium 为 paypal 设置这个之后

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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