【问题标题】:How to automate OTP using selenium web driver with python?如何使用带有 python 的 selenium Web 驱动程序自动化 OTP?
【发布时间】:2020-11-17 12:31:30
【问题描述】:

在网站上提供手机号码登录后,它会要求 otp..必须从 DB 中读取 OTP。如何自动执行从 DB 读取 OTP 以登录的过程。

【问题讨论】:

  • select otp_code from otp_table where number =@number 并将其传递给 Selenium?除此之外,没有足够的细节来回答您的问题
  • @Martheen 感谢您的回复。我正在使用 python 在 UAT 环境中自动化网站的登录过程...当我使用手机号码登录时->它将发送 OTP 以登录->我必须从 DB 中读取该 OTP 才能走得更远。希望这个细节有帮助..
  • 这正是您在问题中所说的。阅读stackoverflow.com/help/how-to-ask 并编辑您的问题

标签: python-3.x database testing selenium-webdriver browser-automation


【解决方案1】:
Hi This is worst practice in selenium automation 


Two Factor Authentication shortly know as 2FA is a authorization mechanism where One Time Password(OTP) is generated using “Authenticator” mobile apps such as “Google Authenticator”, “Microsoft Authenticator” etc., or by SMS, e-mail to authenticate. Automating this seamlessly and consistently is a big challenge in Selenium. There are some ways to automate this process. But that will be another layer on top of our Selenium tests and not secured as well. So, you can avoid automating 2FA.

There are few options to get around 2FA checks:
  1. 在测试环境中为某些用户禁用 2FA,以便您可以在自动化中使用这些用户凭据。
  2. 在您的测试环境中禁用 2FA。
  3. 如果您从某些 IP 登录,请禁用 2FA。这样我们就可以配置我们的测试机 IP 来避免这种情况。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-24
    • 1970-01-01
    • 2023-03-11
    相关资源
    最近更新 更多