如何使用 python 在 window 弹出窗口中输入用户名

How to type user name on a pop up window using python

我有一个任务要完成:

  1. 打开一个网页 https://www.aetna.com/aqc
    1. 现在我需要在弹出窗口中输入用户名和密码。
    2. 点击确定

我尝试使用 pyautogui 包写入功能,但这对我不起作用。我还尝试使用 XPath 获取字段的元素 ID,但也没有用。

请在 Python3

中提出解决方案

提前致谢!!

这种类型的弹出窗口不是普通的弹出窗口。这是一个"http authentication"。 您可以使用请求包插入数据:

from requests.auth import HTTPBasicAuth
requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', 'pass')) 

更多信息here