0

I am programming in Visual Foxpro. I tried to programatically .click() at the submit button. It used to work, but now it triggers nothing. Alternatively I tried to .submit() the form. This too triggers nothing. But if I click the submit button at the website, it works perfectly. Can anyone help me out? arunkasi.co@gmail.com

My coding as as follows:

declare Sleep in kernel32 integer nmilliseconds

WebMain = CREATEOBJECT("InternetExplorer.application")
WebMain.navigate("https://epayment.hasil.gov.my/fpx/one.php")
WebMain.visible = .t.

DO WHILE WebMain.busy .OR. WebMain.readystate#4
   Sleep(300)
ENDDO

WebMain.Document.Forms("LogonForm1").jenis_id.selectedindex = 1
WebMain.Document.Forms("LogonForm1").no_id.Value = "123456781234"
WebMain.Document.Forms("LogonForm1").kapca.Value = "56789"
WebMain.Document.Forms("LogonForm1").cmdSubmit.click() && IT DOES NOT WORK !
WebMain.Document.Forms("LogonForm1").Submit() && ALTERNATIVELY, THIS TOO DOES NOT WORK !
4

2 回答 2

0

您的行为发生变化的最可能原因是 Internet Explorer 的更新,其中他们改进了安全模型,以防止恶意网站将不需要的行为注入其中。

查看您尝试访问的网站是否具有实际的 Web 服务,应用程序可以使用该服务通过 HTTP 而不是使用网页发送 POST 消息(例如使用 MSXML.XMLHTTPRequest 对象)。如果该网站是您公司的网站,那么创建适当的 Web 服务比通过 FoxPro 自动化 Internet Explorer 更能节省时间。

但是,如果这不可能,我相信您可以调整您的代码以使用特定于 IE 的fireEvent方法。

于 2013-08-01T05:15:55.783 回答
0

向 click() 或 submit() 添加参数。这将起作用:

WebMain.Document.Forms("LogonForm1").cmdSubmit.click(1) 
or
WebMain.Document.Forms("LogonForm1").Submit(1) 
于 2015-06-05T10:38:48.617 回答