Please help the scalar that is getting submitted for $input_data when this is submitted it is all one line. The file it reads in has line breaks. txtIncidentDescription is the description field that is having the issue. I am reading in the file with File::Slurp.
#!perl
use strict;
use warnings;
use WWW::Mechanize;
use Term::InKey;
use Win32::Clipboard;
use File::Slurp;
my $ua = LWP::UserAgent->new;
#DETERMINING END USER
my $oldSSO = qx{whoami};
chomp $oldSSO;
my ($sso) = $oldSSO =~ /.*(\w{2}\d{5})/;
#PROMPTING FOR PASSWORD
print "Enter Password: ";
my $pass = &ReadPassword;
chomp $pass;
#SETTING DATA TO SUBMIT
my $input_data = read_file( 'C:/temp/vpn_user.txt' );
#DECLARE URL VARIABLES
my $url1 = "https://url1";
my $url2 = "https://url2";
my $url3 = "https://url3";
#TURN OFF SSL CHECKING
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
#MECHANIZE TO GET AND PRINT CONTENT
my $mech = WWW::Mechanize->new(timeout => 60, autocheck => 1);
#SET COOKIE JAR
$mech->cookie_jar(HTTP::Cookies->new);
#USER AGENT
$mech->agent_alias( 'Windows IE 6' );
$mech->get($url1);
$mech->form_name('Login');
$mech->field(USER => "$sso");
$mech->field(PASSWORD => "$pass");
$mech->click();
$mech->get($url2);
#SET FORM VALUES
$mech->form_name('frmTicketCreate');
$mech->field('ddlProducts' => 1245);
$mech->field('txtIncidentDescription' => $input_data);
$mech->field('ctrlAssignedGroupLookup_mTxtName' => "assigned team");
$mech->field('__EVENTTARGET', 'ctrlAssignedGroupLookup_mBtnSearch_lnkB
+utton');
$mech->submit('ctrlAssignedGroupLookup_mBtnSearch_lnkButton');
my $content_login = $mech->content();
my ($number) = $content_login =~ /ctrlAssignedGroupLookup_mCBLLookupGr
+oups\S value\S\S(\d+)/;
#print $number, "\n";
$mech->field('ctrlAssignedGroupLookup_mCBLLookupGroups' => $number);
#$mech->form_name('frmTicketCreateFileUpload');
#SUBMIT FORM
$mech->form_name('frmTicketCreate');
$mech->field('__EVENTTARGET', 'btnSave_lnkButton');
$mech->submit();
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|