问题描述
当有人使用用户名和密码登录时,我们设置了 Symantec 2-Factor 身份验证。
我需要使用 testcafe 绕过或验证此 2FA 流程。
我知道我们可以使用 testcafe 进行的基本身份验证,但不确定如何进行 2FA。
filename = 'for_python.txt'
with open(filename) as file:
contents = file.read().split()
dict = {}
for word in contents:
if word not in dict:
dict[word] = 1
else:
dict[word] += 1
dict = sorted(dict.items(),key=lambda x: x[1],reverse=True)
for i in dict:
print(i[0],i[1])
解决方法
您需要以编程方式从运行 TestCafe 测试的 NodeJS 进程中获取代码。这是一项艰巨的任务。更常见的方法是在测试模式下禁用或模拟 2FA 过程。如果您希望测试您的 Web 应用程序功能而不是 Symantec 2FA,这是有道理的。