通过 vbscript 与 Edge/HTML 交互 [英] Interact with Edge/HTML through vbscript

查看:229
本文介绍了通过 vbscript 与 Edge/HTML 交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 VBS 新手,在 Edge 中加载 URL 后,我找不到如何与网页交互(基本功能,例如 clic、写点东西).例如,这是我打开网页的方法

I'm new with VBS and I can't find how to interact (basic functions such as clic, write something) with a webpage after having load the URL in Edge. Here is how I open my webpage for instance

dim objShell, strPath1, strAttr1, strAttr2
Set objShell = WScript.CreateObject("WScript.Shell")
strPath1 = """C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"""
strAttr1 = " -inprivate "
strAttr2 = " http://www.someWebPage.com/ "

objShell.Run strPath1 & strAttr1 & strAttr2 

我发现了很多类似的东西:

I've found many things like that :

Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "https://www.somepage.com/"

使用这个对象 IE,似乎可以修改表单,点击这里和那里......但它只适用于 Internet Explorer.

With this object IE, it seems possible to modify forms, click here and there ... But it only worked with Internet Explorer.

我想我可以设法找到合适的有用的 HTLM 代码段(至少这不是我现在正在寻找的 ^^).

I think I can manage to find the right HTLM piece of code that is useful (at least this is not what I'm looking for right now ^^ ).

你有什么建议吗?

先谢谢了

推荐答案

Microsoft Edge 浏览器不支持 VBS 中使用的 COM 自动化接口.如果你想自动化 Microsoft Edge,你应该使用 WebDriver.

Microsoft Edge browser doesn't support the COM automation interface that used in VBS. If you want to automate Microsoft Edge, you should use WebDriver.

要开始使用 WebDriver,您需要下载您选择的测试框架以及适当的语言绑定和 MicrosoftWebDriver 服务器.

To get started using WebDriver, you will need to download a testing framework of your choice along with an appropriate language binding and the MicrosoftWebDriver server.

我们通常使用 Selenium,您可以在此页面下载语言绑定.同时,您可以在此页面.

We usually use Selenium and you could download the language binding in this page. At the same time, you could download Microsof Edge WebDriver in this page.

参考链接:

以编程方式创建 Edge 浏览器实例

Microsoft Edge 是否支持 COM 自动化(InternetExplorer 对象)?

这篇关于通过 vbscript 与 Edge/HTML 交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆