gpt4 book ai didi

forms - 用delphi提交表单

转载 作者:行者123 更新时间:2023-12-02 04:14:48 25 4
gpt4 key购买 nike

我尝试用 Delphi 提交预填表格 - 但这似乎不可能。我预填的网站是:Lufthansa.com advanced search page

我无法点击“查找航类”按钮:

<button type="submit" class="processBtn">
<span class="stageButtonLeft">&nbsp;</span>
<span class="stageButtonRight">Find flights</span>
</button>

或提交表格:

<form method="post" autocomplete="off" 
action="/booking/validation/flightavailability"
id="advancedSearchFlights">

我尝试了几件事:

ie.OleObject.Document.forms.item(2).elements.item(0).click;

ie.OleObject.Document.forms.item(2).elements.item('submit').click;

 Frm := Doc3.getElementById('advancedSearchFlights') as IHtmlFormElement;
if Assigned(Frm) then
Frm.submit;

什么也没有发生。如何通过 Delphi 提交此表单?

最佳答案

您可以使用 chrome 调试表单事件以获取正确的参数并使用 Indy 发布表单。

类似这样的事情...

var
objHttp: TIdHttp;
objPostResponse: TMemoryStream;
objParamPost: TStringList;
begin
objHttp := TIdHTTP.Create(nil);
try
objHttp.HandleRedirects := True;
objHttp.AllowCookies := True;
objHttp.Get('http://www....');
objPostResponse := TMemoryStream.Create;
try
objParametrosPost := TStringList.Create;
try
objParamPost.Add('hdnStatus=ativo');
objHttp.Post('http://www...', objParamPost, objPostResponse);
finally
FreeAndNil(objParamPost);
end;
// do whatever you want with the response
finally
FreeAndNil(objPostResponse);
end;
finally
FreeAndNil(objHttp);
end;
end;

关于forms - 用delphi提交表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22880766/

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