简体   繁体   English

我想通过pywin32更改Internet Explorer的设置

[英]I want to change setting of internet explorer through pywin32

我想通过pywin32更改资源管理器的设置,我能够在浏览器中获取url和数据,但无法访问工具和其他设置选项。

That's interesting task. 那是有趣的任务。 I just don't know how submenu window is created in IE. 我只是不知道如何在IE中创建子菜单窗口。 The following code presses "Tools" menu button (IE 8), but I could not detect a menu window. 以下代码按“工具”菜单按钮(IE 8),但无法检测到菜单窗口。 Workaround is typing keys. 解决方法是键入密钥。

import pywinauto, time

app = pywinauto.Application().start_(r"C:\Program Files (x86)\Internet Explorer\iexplore.exe")
main = app.Window_(title_re='^.* - Windows Internet Explorer$')

main.PageControlToolbar.PressButton(6) # stop loading, just in case
main.ToolbarFile.PressButton('&Tools')
time.sleep(1)
main.TypeKeys('{UP}{ENTER}')

app.InternetOptions.Wait('ready')
app.InternetOptions.TabControl.Select('Connections')

Ah, yes, there's link to pywinauto . 嗯,是的, 有到pywinauto的链接 But the code above is checked on development version of pywinauto , so original pywinauto 0.4.2 may not find "ToolbarFile" properly (use "Toolbar3" instead). 但是上面的代码在pywinauto的开发版本上进行了检查,因此原始pywinauto 0.4.2可能无法正确找到“ ToolbarFile”(请改用“ Toolbar3”)。

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

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