我有一个脚本,我正在尝试使用它登录到 Oracle EBS 页面,并且我相信我离这样做只有一行(我可能是错的)。下面是我的脚本,附件是来自数据的部分,我认为答案就在某个地方。
我认为这是我认为我失败的提交和提交表单行。但如果有人看到其他差异,请告诉我。我确实看到了脚本中的用户名在表单中的位置,但没有看到密码。我确实相信脚本有正确的条目,但如果我错了,请纠正我。
提前致谢!
use strict;
use warnings;
use WWW::Mechanize;
use HTTP::Cookies;
my $outfile = "test";
my $url = "http ://url_address:portnumber /OA_HTML/Login";
my $username = 'johndoe';
my $password = 'johndoe123';
my $mech = WWW::Mechanize->new();
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get($url);
$mech->form_id('DefaultFormName');
$mech->field("usernameField", $username);
$mech->field("passwordField", $password);
$mech->submit_form(
form_id => "DefaultFormName",
fields => {
usernameField => $username,
passwordField => $password,
'_FORM_SUBMIT_BUTTON' => "SubmitButtonofEPmL1A",
},
);
my $output_page = $mech->content();
print $output_page;
open(OUTFILE, ">$outfile");
binmode(OUTFILE, ":utf8");`enter code here`
print OUTFILE "$output_page";
close(OUTFILE);
表格片段:
"name="usernameField" size="0" type="text" value="johndoe">
< src="/OA_HTML/cabo/images/swan/t.gif" width="5"></td></tr><tr><td colspan="2"></td><td><span class="x2o">
(example: john.doe)</span></td></tr></table></td></tr><tr id="region41" align="left"><td id="region131" valign="top"><span class="x9g">*</span></td>
<td id="region51" valign="top"><span class="x9c">Password</span></td><td id="region61"><table id="passwordField__xc_" border="0" cellspacing="0" cellpadding="0"><tr><td align="right" nowrap></td><td></td>
<td valign="top" nowrap><input id="passwordField" title="Password" class=".LoginText" onchange="" name="passwordField" size="0" type="password">
< src="/OA_HTML/cabo/images/swan/t.gif" width="5"></td></tr><tr><td colspan="2"></td><td><span class="x2o">
(example: A1B2c3D4)</span></td></tr></table></td></tr><tr id="region132" align="left"><td id="region139">
</td><td id="region138"></td><td id="region133">
<button id="SubmitButton" title="Login" class="x7g" style="background-image:url(/OA_HTML/cabo/images/swan/btn-bg1.gif)"
onclick="submitForm('DefaultFormName',1,{'_FORM_SUBMIT_BUTTON':'SubmitButtonofEPmL1A'});return false" type="submit">Login</button>< id="item11" src="/OA_HTML/cabo/images/swan/t.gif" width="2" height="1">"