从excel VBA打开Chrome / Firefox并自动填写网页上的字段 [英] Open Chrome/Firefox from excel VBA and auto fill the fields on web page

查看:3280
本文介绍了从excel VBA打开Chrome / Firefox并自动填写网页上的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我在VBA中编写了以下代码,以自动填充Web表单并将其发布到服务器。这工作正常。唯一的问题是,我无法与除了Internet Explorer之外的任何其他浏览器实现相同的效果。

I have following code written in VBA to auto fill the web form and post it to server. This is working fine. The only problem is, I am not able to achieve the same with any other browsers except internet explorer.

Set IE = CreateObject("InternetExplorer.Application")    
IE.Visible = 1    
IE.navigate "https://www.XYZ.com/pages/LoginAdvanced.aspx"    
Do While (IE.Busy)    
  WScript.Sleep 100    
Loop  
IE.document.getElementByID("Username").Value = "UN123"    
IE.document.getElementByID("Password_Text").Value = "PWD123"        
IE.document.getElementByID("Password").Value = "PWD123"        
IE.document.getElementByID("Destination").Value = "TestDB"       

IE.Document.getElementById("cmdLogin1").click()

任何人都可以让我知道如何打开DEFAULT浏览器,通过VBA访问其DOM对象,然后自动填充网页上的字段并发布页面。

Can anybody please let me know how to open a DEFAULT browser, access its DOM object through VBA and later auto-fill the fields on the web page and post the page.

我知道这可以通过使用Selenium来实现Web驱动程序,但我不允许使用任何第三方引用或工具。

I know this can be achieved by using Selenium Web Driver, but I am NOT allowed to use any third party references or tools.

我研究了很多关于通过VBA运行JAVASCRIPT但没有得到任何解决方案。我的计划是编写代码以使用"window.open"打开浏览器。功能,以便默认情况下,页面将在DEFAULT浏览器中打开,然后仅使用javascript填充
网页字段。但我也无法做到这一点。

I researched a lot on running a JAVASCRIPT through VBA but did not get any solution. My plan was to write the code to open the browser using "window.open" function so that bydefault the page will be opened in DEFAULT browser and later fill the web page fields using the javascript only. But I am not able to achieve this as well.

所以,总结是,我想用VBA编写的代码在DEFAULT浏览器中打开网页自动填写网页表格并发布它是服务器。

So, the summary is, I want code written in VBA to open the web page in DEFAULT browser auto fill the web form and post it to server.

请注意,我只允许使用VBA执行此操作。

Please note that I am allowed to do this using VBA only.

请帮帮我。

推荐答案

无法完成。  VBA只会在不使用第三方工具的情况下与IE连接。 



It can't be done.  VBA will only interface to IE without the use of a 3rd party tool. 


这篇关于从excel VBA打开Chrome / Firefox并自动填写网页上的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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