gpt4 book ai didi

python - IE8 自动化和 https

转载 作者:行者123 更新时间:2023-12-01 06:19:37 24 4
gpt4 key购买 nike

我正在尝试通过 COM 使用 IE8 在 Python 中访问安全站点(即 SourceForge)。这是脚本:

from win32com.client import gencache
from win32com.client import Dispatch
import pythoncom

gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}', 0, 1, 1)


class SourceForge(object):
def __init__(self, baseURL='https://sourceforget.net/', *args, **kwargs):
super(SourceForge, self).__init__(*args, **kwargs)

self.__browser = Dispatch('InternetExplorer.Application')
self.__browser.Visible = True
self.__browser.Navigate(baseURL)

def run(self):
while True:
pythoncom.PumpMessages()

def main():
sf = SourceForge()
sf.run()

if __name__ == '__main__':
main()

如果我手动启动 IE,那没问题。如果启动该脚本,我会收到一般错误页面“Internet Explorer 无法显示此页面”。如果我将 baseURL 更改为使用 http 而不是 https,则该脚本可以正常工作。我想这是一些安全“功能”。我尝试将该站点添加到受信任站点列表中。我尝试在 Internet 区域的选项中启用 IE 脚本。不起作用。谷歌没有提供任何帮助。

那么,有人知道这件事吗?是否有一个神秘的选项可以启用,或者我注定要失败?

顺便说一句,我使用的是 Windows XP SP3、Python 2.5 和 pywin32 build 213。

最佳答案

我无法打开 https://sourceforget.net/ ——不是手工,不是脚本。

您确定此链接正确吗?

关于python - IE8 自动化和 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1147193/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com