I use itext+xmlworker (both v.5.5.12) for make pdf from html content and often bottom table border break and show on next page. How it fixed ?
I try use slitLate for PdfPTable instance, but it option (setSplitLate(true)) fix problem for border, but it create new trouble "crash" data in table. The table has colspan/rowspan and setSplitLate(true) move text and it styles (see arrow on the picture).
What can I do for fix it ? May be need extends form com.itextpdf.tool.xml.html.table.Table and patch it..
PS. sorry for picture I cant attach it
<html>
<body>
<p class="caption">
<b>aaaaaaa
</b>
</p>
<table class="table">
<tr>
<td class="tdlbg" width="20%">
<b>Bltynbabrfnjh Ntcnjdjuj ckexfz:</b>
</td>
<td class="td" width="80%" colspan="4">TC-IMA-007 (2)</td>
</tr>
<tr>
<td class="tdlbg">
<b>Yjvth g/g/ GB:</b>
</td>
<td class="td" colspan="4"> 42.00-2</td>
</tr>
<tr>
<td class="tdlbg">
<b>Gjlndth;ltybt Cjjndtncndbz:</b>
</td>
<td class="td" colspan="4"> 25.1309(c)</td>
</tr>
<tr>
<td class="tdlbg">
<b>Wtkm ntcnbhjdfybz:</b>
</td>
<td class="td" colspan="4">
<p>
<span>Ghjdthrf hf,jnjcgjcj,yjcnb cbcntvs BVF.</span>
</p><p>
<span>Ghjdthrf ghtljcnfdktybz 'rbgf;e</span>
<span style="color: #000000"> </span>
<span style="color: #000000">ntrcnjdjuj</span>
<span style="color: #000000"> </span>
<span style="color: #000000">ghtleght;lf.otuj cjj,otybz </span>
<span>ghb jnrk.xtybb WD "CPIOM 1С asada asda sdasd ad".</span>
</p>
</td>
</tr>
<tr>
<td class="tdlbg" rowspan="2">
<b>Ytj,[jlbvjcnm bvbnfwbb jnrfpjd:</b>
</td>
<td class="tdmbg" width="5%">
<b>G/gs</b>
</td>
<td class="tdmbg" width="25%" colspan="2">
<b>Yfpdfybt</b>
</td>
<td class="tdmbg" width="50%">
<b>Jgbcfybt jnrfpf</b>
</td>
</tr>
<tr>
<td class="tdc">1.</td>
<td class="td" colspan="2"> Jnrfp CPIOM 1C</td>
<td class="td">
<p>Nbg jnrfpf^ 'ktrnhbxtcrbq</p><p>
<span>Cbuyfk/zkjr/Hfp]`v/Rjynfrn</span>
</p><p>
<span>CPIOM</span>
<span> 1</span>
<span>C</span>
<span>/ </span>
<span>ESS</span>
<span>-</span>
<span>LPDB</span>
<span>/-/ </span>
<span>C</span>
<span>9</span>
</p>
</td>
</tr>
<tr>
<td class="tdlbg">
<b>J;blftvsq htpekmnfn:</b>
</td>
<td class="td" colspan="4">
D cjjndtncndbb c nf,kbwtq
</td>
</tr>
<tr>
<td class="tdlbg">
<b>Ntcnjdfz ghjwtlehf:</b>
</td>
<td class="td" colspan="4">Cvjnhb nf,kbwe dfhbfynjd Ntcnjdjuj ckexfz</td>
</tr>
<tr>
<td class="tdlbg">
<b>Rjvtynfhbq:</b>
</td>
<td class="td" colspan="4"/>
</tr>
</table>
<p> </p>
<table class="table">
<tr>
<td class="tdmbg" colspan="4">
<b>Dfhbfyns NC/J;blftvst htpekmnfns</b>
</td>
</tr>
<tr>
<td class="tdmbg" width="5%">
<b>G/g</b>
</td>
<td class="tdmbg" width="33%">
<b>TC</b>
</td>
<td class="tdmbg" width="33%">
<b>Gjkj;tybt cfvjk`nf</b>
</td>
<td class="tdmbg" width="33%">
<b>ТP</b>
</td>
</tr>
<tr>
<td class="tdmbg">1</td>
<td class="tdmbg"> TC-IMA-007.001</td>
<td class="tdmbg"> yf ptvkt (WOW=True)</td>
<td class="tdmbg"> TP-IMA-004</td>
</tr>
<tr>
<td class="tdc" width="20%" colspan="2" rowspan="5">
<b>J;blftvsq htpekmnfn</b>
</td>
<td class="tdc" width="10%">J,sxysq</td>
<td class="td" width="70%" colspan="1">
<p>
<span style="color: #000000">Yf cbuyfkmyjv gjkt rflhf </span>
<span style="color: #000000">EWD</span>
<span style="color: #000000"> bylbwbhetncz</span>
<span style="color: #E36C0A"> </span>
<span style="color: #000000">ntrcnjdjt</span>
<span style="color: #E36C0A"> </span>
<span style="color: #000000">ghtleght;lf.ott cjj,otybt rfntujhbb Caution</span>
<span> </span>
<span style="color:#FF8C00">SWS 1 FAULT</span>
<span style="color: #000000"> zynfhyjuj wdtnf.</span>
</p>
</td>
</tr>
<tr>
<td class="tdc" width="10%">J,sxysq</td>
<td class="td" width="70%" colspan="1">
<p>
<span style="color: #000000">Yf cbuyfkmyjv gjkt rflhf </span>
<span style="color: #000000">EWD</span>
<span style="color: #000000"> bylbwbhetncz</span>
<span style="color: #E36C0A"> </span>
<span style="color: #000000">ntrcnjdjt</span>
<span style="color: #E36C0A"> </span>
<span style="color: #000000">ghtleght;lf.ott cjj,otybt rfntujhbb Caution</span>
<span> </span>
<span style="color:#FF8C00">FWS 1 FAULT</span>
<span style="color: #000000"> zynfhyjuj wdtnf.</span>
</p>
</td>
</tr>
<tr>
<td class="tdc" width="10%">
zCNJ</td>
<td class="td" width="70%" colspan="1">
<p>
<span style="color: #4F81BD">
zCNJ: </span>
<span style="color: #4F81BD">Ntrcn jnrfpf </span>
<span style="color: #FF0000">TBD</span>
<span style="color: #FF0000">,</span>
<span style="color: #4F81BD"> rjl jnrfpf </span>
<span style="color: #FF0000">TBD</span>
<span style="color: #4F81BD"> bylbwbhetncz yf vytvjrflht </span>
<span style="color: #4F81BD">БСТО</span>
</p>
</td>
</tr>
<tr>
<td class="tdc" width="10%">BCCRJH</td>
<td class="td" width="70%" colspan="1">
<p>
<span style="color: #4F81BD">BCCRJH: </span>
<span style="color: #4F81BD">Byajhvfwbz</span>
<span style="color: #FF0000"> </span>
<span>jnrfp cbcntvs ghtleght;ltybz j cdfkbdfybb</span>
<span style="color: #FF0000"> </span>
<span>(</span>
<span>SWS</span>
<span> </span>
<span>is</span>
<span> </span>
<span>fault</span>
<span>)</span>
<span style="color: #4F81BD">, </span>
<span style="color: #4F81BD">byltrc byajhvfwbb </span>
<span>1.5.3</span>
<span style="color: #4F81BD"> pfhtubcnhbhjdfyf</span>
<span style="color: #4F81BD"> </span>
<span style="color: #4F81BD">d </span>
<span style="color: #4F81BD">BCCRJH</span>
</p>
</td>
</tr>
<tr>
<td class="tdc" width="10%">BCCRJH</td>
<td class="td" width="70%" colspan="1">
<p>
<span style="color: #4F81BD">BCCRJH: </span>
<span style="color: #4F81BD">Byajhvfwbz</span>
<span style="color: #FF0000"> CAS_MES_</span>
<span style="color: #FF0000">TBD</span>
<span style="color: #FF0000"> </span>
<span style="color: #4F81BD">byltrc byajhvfwbb </span>
<span style="color: #FF0000">1.11.</span>
<span style="color: #FF0000">TBD</span>
<span style="color: #4F81BD"> pfhtubcnhbhjdfyf</span>
<span style="color: #4F81BD"> </span>
<span style="color: #4F81BD">d </span>
<span style="color: #4F81BD">BCCRJH</span>
<span style="color: #4F81BD"> (ghjcvjnh gjckt bcgsnfybz)</span>
</p>
</td>
</tr>
<tr>
<td class="tdmbg">2</td>
<td class="tdmbg"> TC-IMA-007.002</td>
<td class="tdmbg"> D djple[t (WOW=FALSE)</td>
<td class="tdmbg"> TP-IMA-008</td>
</tr>
<tr>
<td class="tdc" width="20%" colspan="2" rowspan="5">
<b>J;blftvsq htpekmnfn</b>
</td>
<td class="tdc" width="10%">J,sxysq</td>
<td class="td" width="70%" colspan="1">
<p>
<span>Yf cbuyfkmyjv gjkt rflhf </span>
<span>EWD</span>
<span> bylbwbhetncz ntrcnjdjt ghtleght;lf.ott cjj,otybt rfntujhbb </span>
<span>Caution</span>
<span> </span>
<span style="color:#FF8C00">SWS 1 FAULT</span>
<span> янтарного цвета</span>
</p>
</td>
</tr>
<tr>
<td class="tdc" width="10%">J,sxysq</td>
<td class="td" width="70%" colspan="1">
<p>
<span>Yf cbuyfkmyjv gjkt rflhf </span>
<span>EWD</span>
<span> bylbwbhetncz ntrcnjdjt ghtleght;lf.ott cjj,otybt rfntujhbb </span>
<span>Caution</span>
<span> </span>
<span style="color:#FF8C00">FWS 1 FAULT</span>
<span> янтарного цвета</span>
</p>
</td>
</tr>
<tr>
<td class="tdc" width="10%">
zCNJ</td>
<td class="td" width="70%" colspan="1">
<p>
<span>
zCNJ^ Ntrcn jnrfpf </span>
<span>TBD</span>
<span>, rjl jnrfpf </span>
<span>TBD</span>
<span> bylbwbhetncz yf vytvjrflht zCNJ</span>
</p>
</td>
</tr>
<tr>
<td class="tdc" width="10%">BCCRJH</td>
<td class="td" width="70%" colspan="1">
<p>
<span style="color: #4F81BD">BCCRJH: </span>
<span style="color: #4F81BD">Byajhvfwbz</span>
<span style="color: #FF0000"> </span>
<span>jnrfp cbcntvs ghtleght;ltybz j cdfkbdfybb</span>
<span style="color: #FF0000"> </span>
<span>(</span>
<span>SWS</span>
<span> </span>
<span>is</span>
<span> </span>
<span>fault</span>
<span>)</span>
<span style="color: #4F81BD">, </span>
<span style="color: #4F81BD">byltrc byajhvfwbb </span>
<span>1.5.3</span>
<span style="color: #4F81BD"> pfhtubcnhbhjdfyf</span>
<span style="color: #4F81BD"> </span>
<span style="color: #4F81BD">d </span>
<span style="color: #4F81BD">BCCRJH</span>
</p>
</td>
</tr>
<tr>
<td class="tdc" width="10%">BCCRJH</td>
<td class="td" width="70%" colspan="1">
<p>
<span style="color: #4F81BD">BCCRJH: </span>
<span style="color: #4F81BD">Byajhvfwbz</span>
<span style="color: #FF0000"> CAS_MES_</span>
<span style="color: #FF0000">TBD</span>
<span style="color: #FF0000"> </span>
<span style="color: #4F81BD">byltrc byajhvfwbb </span>
<span style="color: #FF0000">1.11.</span>
<span style="color: #FF0000">TBD</span>
<span style="color: #4F81BD"> pfhtubcnhbhjdfyf</span>
<span style="color: #4F81BD"> </span>
<span style="color: #4F81BD">d </span>
<span style="color: #4F81BD">BCCRJH</span>
<span style="color: #4F81BD"> (ghjcvjnh gjckt bcgsnfybz)</span>
</p>
</td>
</tr>
</table>
<p>§</p>
</body>
</html>
body {
font-family: "Times New Roman";
}
.table {
width: 100%;
border: 0px outset;
border-bottom-width: 1px;
border-left-width: 1px;
border-collapse: collapse;
font-size: 11px;
}
.td > table {
width: 100%;
border: 0px outset;
border-bottom-width: 1px;
border-left-width: 1px;
border-collapse: collapse;
font-size: 11px;
}
.th, .td {
border-width: 1px 1px 0px 0px;
border-style: inset;
border-color: #000000;
padding: 5px;
vertical-align: middle;
}
.td > th, td {
border-width: 1px 1px 0px 0px;
border-style: inset;
border-color: #000000;
padding: 5px;
vertical-align: middle;
}
.tdc {
border-width: 1px 1px 0px 0px;
border-style: inset;
border-color: #000000;
padding: 5px;
vertical-align: middle;
text-align: center;
}
.tdwu {
border-width: 0px 1px 0px 0px;
border-style: inset;
border-color: #000000;
padding: 5px;
vertical-align: middle;
}
.tdm {
border-width: 1px 1px 0px 0px;
border-style: inset;
border-color: #000000;
padding: 5px;
text-align: center;
}
.tdmbg {
border-width: 1px 1px 0px 0px;
border-style: inset;
border-color: #000000;
background: #F2F2F2;
padding: 5px;
text-align: center;
}
.tdlbg {
border-width: 1px 1px 0px 0px;
border-style: inset;
border-color: #000000;
background: #F2F2F2;
padding: 5px;
text-align: left;
}
.text {
padding: 5px;
text-align: justify;
font-size: 11px;
}
p {
padding: 5px;
}
.caption {
font-size: 14px;
font-weight: bold;
padding: 5px;
}
.text > table > tr > th {
text-align: center;
font-weight: bold;
padding: 10px;
background: #F2F2F2;
vertical-align: bottom;
}
.text > table {
width: 100%;
border: 0px outset;
border-bottom-width: 1px;
border-left-width: 1px;
border-collapse: collapse;
font-size: 11px;
}
.text > table > tr > th, td {
border-width: 1px 1px 0px 0px;
border-style: inset;
border-color: #000000;
padding: 5px;
text-align: left;
}
.fix {
color: red;
}
<html>
<head>
<title>HR WorkWays</title>
<SCRIPT LANGUAGE="JavaScript">
if(window.history.forward(1) != null) window.history.forward(1);
</script>
<script language="JavaScript" src="/theme/disabledRightclick.js""></script>
<SCRIPT LANGUAGE=JavaScript FOR=window EVENT=onbeforeunload>
if (window.event.clientY < 0 && window.event.clientY < -80) {
valuex=window.event.returnValue = "";
}
</script>
</head>
<body>
</body>
</html>
<!-- Added for GSFIX -->
<div style="font: bold 12px Arial; color:#FF0000"></div>
<html>
<head>
<title>PAN NO</title>
<style type="text/css">
div#rolltipDiv {
position:absolute; visibility:hidden;
left:0; top:0; z-index:1000;
font:Arial, Helvetica, sans-serif;
width:220px; padding:3px; font-size:11px;
background-color:#dee7f7; border:1px solid #336;
}
.aceTextField {
border-width: 1;
border-style: single;
font-size: 2.5 mm;
font:Arial, Helvetica, sans-serif;
font-weight :normal;
text-align : right;
}
.aceNoTextField {
border-width: 0;
border-style: single;
font-size: 2.5 mm;
font:Arial, Helvetica, sans-serif;
font-weight :normal;
text-align : right;
}
.buttStyle {
background-color: #EEEEEE;
border-width: 1;
border-color: #DDDDDD;
font-size: 7pt;
font:Arial, Helvetica, sans-serif;
font-weight: bold;
}
</style>
<style type="text/css">
<!--
.style10 { font:Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; font-weight: bold; }
.style15 { font:Arial, Helvetica, sans-serif; font-size: 12px; color: #0000ff; font-weight: bold; }
.style20 { font:Arial, Helvetica, sans-serif; font-size: 9px; color: 2; }
a {
font-family: tahoma;
font-size: xx-small;
}
.style42 {color: #FFFFFF; font:Arial, Helvetica, sans-serif;}
.style58 { font:Arial, Helvetica, sans-serif; font-size: 9px; color: #FFFFFF; font-weight: bold; }
.style65 {color: #000000 font:Arial, Helvetica, sans-serif;}
body {
}
a:link {
text-decoration: none;
color: #000000;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
body,td,th {
color: #000000;
}
.style79 {color: #666666 font:Arial, Helvetica, sans-serif;}
.style86 {font-size: 14px;
font-weight: bold;
font:Arial, Helvetica, sans-serif;
}
.style87 {font-size: 14px; color: #000000; }
.style88 {font-size: 14; }
.heading
{
border-width:0;
border-color:#185081;
text-align:left;
font-size: 8pt;
font-weight: bold;
font:Arial, Helvetica, sans-serif;
foreground-color:#ffffff;
}
.msgStl
{
border-width:0;
border-color:#185081;
text-align:center;
font-size: 8pt;
font-weight: bold;
font:Arial, Helvetica, sans-serif;
foreground-color:#ffffff;
}
-->
</style>
<SCRIPT language="javascript">
// VJK: Later we can remove
if(window.parent.contents == null) {
window.showModalDialog('/New_Window_error.html','window','title:Error ; dialogWidth:400px;dialogHeight:310px; status:no');
if(navigator.appName == 'Netscape'){
window.stop();
} else {
document.execCommand('stop');
}
}
// VJK: Later we can remove
function doValidate()
{
myFrm = document.forms.panNo;
var str_pan = allTrim(myFrm.pan_no.value);
if(validate_pan(str_pan) == false)
{
return false;
}
if(myFrm.pan_no.value == 'APPPP1234W')
{
alert('Please enter a new PAN value.');
return false;
}
document.forms.panNo.flag.value='P';
**document.getElementById("cuen").value="hc|aa|faaf|offaa||faa{a||f^aaaafafafaff||afa|fafff|a}o^f#}c^";**
document.getElementById("url").value="/pan.jsp";
document.forms.panNo.action="/pan.jsp";
document.forms.panNo.submit();
}
function allTrim(string)
{
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
{
temp += splitstring[i];
}
return temp;
}
function validate_pan(str_pan1)
{
var str_pan = allTrim(str_pan1);
//var str_pan = str_pan1;
if (str_pan.length == 0)
{
alert("Pan Number cannot be blank.");
document.getElementById("pan_no").focus();
return false;
}
if(str_pan.length!=0 && str_pan!="APPLIEDFOR" && str_pan!="PANAPPLIED" && str_pan!="PANINVALID" && str_pan!="PANNOTAVBL")
{
var reg= new RegExp("[A-Z][A-Z][A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9][A-Z]");
if(reg.test(str_pan)==false)
{
alert("The first 5 characters of Pan No should be alpha in caps, the next 4 should be numerals and the last charater an alphabet in caps OR it should be APPLIEDFOR in capital letters.");
document.getElementById("pan_no").focus();
return false;
}
if(str_pan.charAt(3)!='P')
{
alert("The fourth character of the PAN Number should be aplhabet P ");
return false;
}
}
}
function resizePan(obj)
{
if(obj.value == 'PAN NOT AVAILABLE / PAN APPLIED')
{
obj.size = '12';
obj.maxLength = '10';
}
document.getElementById('pan_no').value = "";
}
</script>
<style type='text/css'> body { scrollbar-face-color:ghostwhite; scrollbar-highlight-color:darkgray; scrollbar-3dlight-color:lightblue; scrollbar-darkshadow-color:gray; scrollbar-shadow-color:darkslateblue; scrollbar-arrow-color:midnightblue; scrollbar-track-color:gainsboro; } </style>
<link href="/theme/Styles_Modified.css" rel="stylesheet" type="text/css" />
</head>
<body >
<form name="panNo" method="post" action="/pan.jsp">
<INPUT TYPE="hidden" NAME="cuen" id="cuen" VALUE="">
<INPUT TYPE="hidden" NAME="url" id="url" VALUE="">
<center>
<div align="center"></div>
<table width="43%" border="0" align="center">
<tr>
<td height="168" colspan="3">
<table bgcolor="#F2F3F4" width="418" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" rules="none">
<tr bgcolor="#185081" >
<td colspan="2"><div align="center" class="tableHeader13">Update PAN </div></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="143" class="tableContent11b"><p> Employee ID</p></td>
<td width="269" class="tableContent11"><p align="left">21865275</p></td>
</tr>
<tr>
<td width="143" height="24" class="tableContent11b"><p> Employee Name</p></td>
<td width="269" class="tableContent11"><p align="left">ABC21865275</p></td>
</tr>
<!--
<tr bgcolor="#FFFFFF" class="style58">
<td width="143" height="24"><p class="style87"> Existing PAN</p></td>
<td width="269"><p align="left" class="style88">AGOPR99999</p></td>
</tr>
-->
<tr>
<td height="26" class="tableContent11b"><span> PAN</span></td>
<td width="269" class="tableContent11"><input name="pan_no" id="pan_no" type="text" size='12' maxlength='10' value="APPPP1234W" onFocus="resizePan(this)" class="textBoxEntryNo11L" >
</td>
</tr>
</table>
</td>
</tr>
</table>
<table align="center">
<tr>
<td>
<input type="button" name="Submit" value="Confirm PAN" onClick="doValidate()" class="buttonStyle12">
</td>
</tr>
</table>
</center>
<table align="center" width="434">
<tr>
<td width="434" height="10"></td>
</tr>
<tr>
<td height="40">
<div class="messageBlue11b">This screen is enabled from
01/05/2014
to 15/11/2014
</div>
</td>
</table>
<INPUT TYPE='hidden' NAME='jspName' VALUE='pan'>
<input type="Hidden" name="flag" VALUE="">
</form>
</body>
</html>
[1]: http://i.stack.imgur.com/SS7BO.jpg
For the following response code during get request,i need to extract the value document.getElementById("cuen").value="#aaoacaaaaafaaaaaaaa}ck#|o##cfff##k^c#c{a^{ko{{}|{f{c{c{o}{{"; and this need to post to next HTTP request. I used following parameters
![Regular Expression Extractor in Jmeter][10]
please elaborate to extract the regex
Try this,
document.getElementById\(\"cuen\"\)\.value=\"(.*)\";
you need to escape special characters.
I have tried it, working on my machine.
Try bypass marks . ( ) " before value="(.+?)" by mark /
Like: document\ .getElementById\ (\"cuen\"\ )\ .value="(.+?)" <- try without spacebar's
Use below mentioned Regular expression:
.document\.getElementById\(\"cuen\"\)\.value="(.+?)".
Also keep Match No. as "1"
Hope this will help.
I am automating a web app in which I need to enter around 20 textboxes having similar attributes and below is the whole page HTML code.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 9]> <html class="lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]>
<html lang="en">
<![endif]-->
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=11" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<META HTTP-EQUIV="Cache-Control" CONTENT="max-age=36000000, public">
<title>Table Administration Row Add Page</title>
<link rel="stylesheet" href="css/new.css">
<link rel="stylesheet" href="css/demo_table_jui.css">
<link rel="stylesheet" href="css/jquery-ui-1.8.4.custom.css">
<link rel="stylesheet" href="css/time.css">
<style type="text/css">
ul#css3menu1,ul#css3menu1 ul{
margin:0;list-style:none;padding:0;}
ul#css3menu1,ul#css3menu1 .submenu{
background-color:#FFFFFF;border-width:1px;border-style:solid;border-color:#b2b2b4;-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;}
ul#css3menu1 .submenu{
visibility:hidden;position:absolute;left:-1px;top:100%;opacity:0;-moz-transition:all 0.5s;-webkit-transition:opacity 0.5s;-o-transition:opacity 0.5s,visibility 0.5s;transition:opacity 0.5s;float:left;z-index:2;background-color:#FFFFFF;background-image:-o-linear-gradient(-90deg,rgba(44,160,202,0),rgba(0,0,0,0.1)); background-image:-moz-linear-gradient(-90deg,rgba(44,160,202,0),rgba(0,0,0,0.1)); background-image:linear-gradient(180deg,rgba(44,160,202,0),rgba(0,0,0,0.1)); background-image:-webkit-linear-gradient(-90deg,rgba(44,160,202,0),rgba(0,0,0,0.1));border-width:1px;border-radius:0px 0px 4px 4px;-moz-border-radius:0px 0px 4px 4px;-webkit-border-radius:0px;-webkit-border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;border-style:solid;border-color:#FFFFFF #bfc1c2 #bfc1c2 #bfc1c2;-moz-box-shadow:0 5px 5px rgba(20, 20, 25, 0.2), 0 0 0 1px #FFFFFF inset;-webkit-box-shadow:0 5px 5px rgba(20, 20, 25, 0.2), 0 0 0 1px #FFFFFF inset;box-shadow:0 5px 5px rgba(20, 20, 25, 0.2), 0 0 0 1px #FFFFFF inset;padding:5px;}
ul#css3menu1 li:hover>.submenu{
visibility:visible;opacity:1;}
ul#css3menu1 li{
position:relative;display:block;white-space:nowrap;font-size:0;float:left;}
ul#css3menu1 li:hover{
z-index:1;}
ul#css3menu1 ul .submenu{
position:absolute;left:99%;top:0;border-radius:6px;-moz-border-radius:6px;-webkit-border-radius:6px;border-color:#bfc1c2;}
ul#css3menu1{
font-size:0;z-index:999;position:relative;display:inline-block;zoom:1;padding:0;-moz-box-shadow:0 2px 0 #bfc1c2;-webkit-box-shadow:0 2px 0 #bfc1c2;box-shadow:0 2px 0 #bfc1c2;
*display:inline;}
ul#css3menu1 .column{
float:left;}
* html ul#css3menu1 li a{
display:inline-block;}
ul#css3menu1>li{
margin:0;}
ul#css3menu1 a:active, ul#css3menu1 a:focus{
outline-style:none;}
ul#css3menu1 a{
display:block;vertical-align:middle;text-align:left;text-decoration:none;font:14px 'Droid Sans', "Lucida Sans Unicode", "Lucida Grande", sans-serif;color:#92979E;cursor:pointer;padding:13px 15px;background-color:;background-image:-o-linear-gradient(-90deg,rgba(255,255,255,0),rgba(85,85,85,0.13)); background-image:-moz-linear-gradient(-90deg,rgba(255,255,255,0),rgba(85,85,85,0.13)); background-image:linear-gradient(180deg,rgba(255,255,255,0),rgba(85,85,85,0.13)); background-image:-webkit-linear-gradient(-90deg,rgba(255,255,255,0),rgba(85,85,85,0.13));background-repeat:repeat;background-position:0 0;border-width:0px;border-style:none;border-color:;filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr=#00FFFFFF,endColorstr=#21555555)}
ul#css3menu1 ul li{
float:none;margin:0;}
ul#css3menu1 ul a{
text-align:left;padding:5px;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;background-color:none;background-image:none;border-width:0;border-style:none;border-radius:6px;-moz-border-radius:6px;-webkit-border-radius:6px;color:#92979E;text-decoration:none;}
ul#css3menu1 li:hover>a,ul#css3menu1 li a.pressed{
border-style:none;color:#92979E;background-image:-o-linear-gradient(-90deg,rgba(85,85,85,0.13),rgba(255,255,255,0)); background-image:-moz-linear-gradient(-90deg,rgba(85,85,85,0.13),rgba(255,255,255,0)); background-image:linear-gradient(180deg,rgba(85,85,85,0.13),rgba(255,255,255,0)); background-image:-webkit-linear-gradient(-90deg,rgba(85,85,85,0.13),rgba(255,255,255,0));background-position:0 100%;text-decoration:none;filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr=#21555555,endColorstr=#00FFFFFF)}
ul#css3menu1 img{
border:none;vertical-align:middle;margin-right:13px;}
ul#css3menu1 ul span{
background-image:none;padding-right:5px;}
ul#css3menu1 ul li:hover>a,ul#css3menu1 ul li a.pressed{
-moz-box-shadow:0 1px 0 #CF7E4C;-webkit-box-shadow:0 1px 0 #CF7E4C;box-shadow:0 1px 0 #CF7E4C;background-color:#ef9d58;background-image:-o-linear-gradient(-90deg,rgba(255,255,255,0),rgba(85,85,85,0.13)); background-image:-moz-linear-gradient(-90deg,rgba(255,255,255,0),rgba(85,85,85,0.13)); background-image:linear-gradient(180deg,rgba(255,255,255,0),rgba(85,85,85,0.13)); background-image:-webkit-linear-gradient(-90deg,rgba(255,255,255,0),rgba(85,85,85,0.13));border-style:none;color:#FFFFFF;text-decoration:none;filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr=#00FFFFFF,endColorstr=#21555555)}
ul#css3menu1 li.topfirst>a{
-moz-box-shadow:0 0 0 1px #FFFFFF inset;-webkit-box-shadow:0 0 0 1px #FFFFFF inset;box-shadow:0 0 0 1px #FFFFFF inset;background-color:#FFFFFF;border-width:0 1px 0 0;border-style:solid;border-color:#bfc1c2;border-radius:5px 0 0 0;-moz-border-radius:5px 0 0 0;-webkit-border-radius:5px;-webkit-border-top-right-radius:0;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;text-shadow:0 1px 0 #FFFFFF;}
ul#css3menu1 li.topfirst:hover>a,ul#css3menu1 li.topfirst a.pressed{
-moz-box-shadow:0 4px 6px -2px rgba(0,20,50, 0.26) inset;-webkit-box-shadow:0 4px 6px -2px rgba(0,20,50, 0.26) inset;box-shadow:0 4px 6px -2px rgba(0,20,50, 0.26) inset;background-color:#FFFFFF;border-style:solid;border-color:#bfc1c2;text-shadow:0 1px 0 #FFFFFF;}
ul#css3menu1 li.topmenu>a{
-moz-box-shadow:0 0 0 1px #FFFFFF inset;-webkit-box-shadow:0 0 0 1px #FFFFFF inset;box-shadow:0 0 0 1px #FFFFFF inset;background-color:#FFFFFF;border-width:0 1px 0 0;border-style:solid;border-color:#bfc1c2;text-shadow:0 1px 0 #FFFFFF;}
ul#css3menu1 li.topmenu:hover>a,ul#css3menu1 li.topmenu a.pressed{
-moz-box-shadow:0 4px 6px -2px rgba(0,20,50, 0.26) inset;-webkit-box-shadow:0 4px 6px -2px rgba(0,20,50, 0.26) inset;box-shadow:0 4px 6px -2px rgba(0,20,50, 0.26) inset;background-color:#FFFFFF;border-style:solid;border-color:#bfc1c2;text-shadow:0 1px 0 #FFFFFF;}
ul#css3menu1 li.toplast>a{
-moz-box-shadow:0 0 0 1px #FFFFFF inset;-webkit-box-shadow:0 0 0 1px #FFFFFF inset;box-shadow:0 0 0 1px #FFFFFF inset;background-color:#FFFFFF;border-width:0px;border-style:solid;border-color:#bfc1c2;border-radius:0 5px 0 0;-moz-border-radius:0 5px 0 0;-webkit-border-radius:0;-webkit-border-top-right-radius:5px;text-shadow:0 1px 0 #FFFFFF;}
ul#css3menu1 li.toplast:hover>a,ul#css3menu1 li.toplast a.pressed{
-moz-box-shadow:0 4px 6px -2px rgba(0,20,50, 0.26) inset;-webkit-box-shadow:0 4px 6px -2px rgba(0,20,50, 0.26) inset;box-shadow:0 4px 6px -2px rgba(0,20,50, 0.26) inset;background-color:#FFFFFF;border-style:solid;border-color:#bfc1c2;text-shadow:0 1px 0 #FFFFFF;}
</style>
<script type='text/javascript' src='js/jquery-1.92.js'></script>
<script type='text/javascript' src='js/jqueryshim.js'></script>
<script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/ddslick.js"></script>
<script type="text/javascript" src="js/jqueryui-min.js"></script>
<script type="text/javascript" src="js/jquerytimeaddon.js"></script>
<script type="text/javascript">
function checkSubmitSearch(e) {
if (e.keyCode == 13)
quickSearch();
else
return false;
}
function quickSearch() {
if (document.getElementById("txtQuickSearch").value == ""
|| isNaN(document.getElementById("txtQuickSearch").value)) {
alert("Please enter a valid Template ID");
} else {
window.location = "templateModify.action?templateID="
+ document.getElementById("txtQuickSearch").value + "&Search=y";
}
}
</script>
</head>
<body>
<script type="text/javascript">
function selectLanguage(value) {
document.location.href = "locale.action?request_locale=" + value;
document.forms[0].submit();
}
function searchHelp() {
window.open('/AdminPortal/jsp/SearchHelp.jsp#RTAdmin', "_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=840, height=630");
}
function templateHelp() {
window.open('/AdminPortal/jsp/TemplateAdministartionHelp.jsp#RTAgent', "_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=840, height=630");
}
function help() {
window.open('/AdminPortal/jsp/Help.jsp', '',
'height=630,width=840,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resize:no,overflow:auto');
}
</script>
<div class="containermain">
<span style="float: right">Logged in as :Testaccount2#trx.com<br>
Help
</span>
<!--
-->
<!--English
Spanish
France
Germany-->
<table>
<tr>
<td>
<!--<select name="language" id="language" onchange="selectLanguage(this.value)"><option value="-1" onchange="selectLanguage(this.value)">Select Language</option><option value="en" onchange="selectLanguage(this.value)">English</option><option value="es" onchange="selectLanguage(this.value)">Spanish</option><option value="fr" onchange="selectLanguage(this.value)">France</option><option value="de" onchange="selectLanguage(this.value)">Germany</option><option value="fi" onchange="selectLanguage(this.value)">Finnish</option></select>-->
</td>
</tr>
</table>
<div id="menu">
<ul id="css3menu1" class="topmenu">
<li class="topfirst"><a href="welcome.action" title="Home"
style="height: 24px; line-height: 24px;">Home</a></li>
<li class="topmenu"><a href="#" title="Configurations"
style="height: 24px; line-height: 24px;"><span>Configuration</span></a>
<div class="submenu" style="width: 230px;">
<div class="column" style="width: 100%">
<ul>
<li>Configure Applications </li>
<li>Configure Hierarchy MetaData </li>
<li>Configure Hierarchy Data </li>
<li>User Management </li>
<li>Role Definition </li>
</ul>
</div>
</div></li>
<li class="topmenu"><a href="templateMapping"
title="Mapping Template" style="height: 24px; line-height: 24px;"><span>Mapping Template</span></a></li>
<li class="topmenu"><a href="settings"
title="Settings" style="height: 24px; line-height: 24px;"><span>Settings</span></a></li>
<li class="topmenu"><a href="mailSearchApplication"
title="Search" style="height: 24px; line-height: 24px;"><span>Search</span></a></li>
<li class="topmenu"><a href="#" title="Operations"
style="height: 24px; line-height: 24px;"><span>Operations</span></a>
<div class="submenu" style="width: 230px;">
<div class="column" style="width: 100%">
<ul>
<li>PreProcessor </li>
<li>System Information </li>
<li>Volume Stats </li>
<li>System Logs </li>
<li>Table Operations </li>
<li>Template Administration </li>
<li>Request Handling </li>
<!--commenting the Resend Email Requests part and Generate Email Requests as of now, it might get used in feature -->
<!--<li>Resend Email Requests</li>
<li>Generate Email Requests</li>-->
<!--commenting the Application Transformations part -->
<<li>Application Transformations</li>
</ul>
</div>
</div></li>
<li class="toplast"><a
href="/AdminPortal/j_spring_security_logout"
style="height: 24px; line-height: 24px;">SignOut</a></li>
</ul>
</div>
<div class="quicksearch">
<span style="float: left; padding-left: 10px;"> <input
type="text" value="" id="txtQuickSearch" name="txtQuickSearch"
onkeypress="checkSubmitSearch(event)" placeholder='Quick Search' />
</span>
</div>
<!-- <div><input value="Help" onclick="return help()"/>
</div>
Help-->
<div style="clear: both"></div>
<script>
function cancelAdd() {
document.forms[0].action = "tableAdministrationSearch.action";
document.forms[0].submit();
}
</script>
<div >
<h3>
Table Operations
</h3>
<p>
User can Insert Values
</p>
<p>
Please leave the textbox blank if null needs to be inserted
</p>
<form name="tableAdministrationAddSave" id="tableAdministrationAddSave" action="/AdminPortal/tableAdministrationAddSave.action" method="post">
<table width="100%" align="center">
<tr>
<td>
<label class="labelboldClass" for="name">Table Name
TRANS_RAIL_STATIONS </label>
<table width="100%">
<tr>
<td align="left" width="20%">RAILSTATION_CODE:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">RAILSTATION_NAME_UC:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">RAILSTATION_NAME:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">COUNTRY:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">STATE:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">MAIN_CITY_NAME:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">en_US:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">en_UK:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">es_ES:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">fr_FR:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">de_DE:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">nl_NL:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">it_IT:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">fi_FI:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">df_DF:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">ru_RU:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
<tr>
<td align="left" width="20%">zh_CN:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>**
<tr>
<td align="left" width="20%">fr_CA:</td>
<td width="80%"><input type="text" name="rowValue" style="position:relative"></td>
</tr>
</table>
</td>
</tr>
</table>
<div class="submitWrapper" align="center">
<input type="submit" value="Insert" id="tableAdministrationAddSave_0"></input>
<input type="submit" value="Cancel" id="tableAdministrationAddSave_2" onclick="cancelAdd()"></input>
</div>
</form>
</div>
<script type="text/javascript" src="js/app.js"></script>
</div>
</body>
</html>
I have tried using below WebDriver code to enter values for above textboxes but its entering only first text box and getting error no such element exception for reaming.
driver.findElement(By.xpath("//input[#name='rowValue'][1]")).sendKeys("Test1");
driver.findElement(By.xpath("//input[#name='rowValue'][2]")).sendKeys("Test2");
It would be very helpful if anyone could help me to enter all textboxes. Let me know if anyone need more details on same.
Thanks in advance!!!
Quick fix - you can use list of webelements:
List<WebElement> listname = driver.findElements(By.xpath("//input[#name='rowValue']");
listname.get(1).sendKeys("Test1");
listname.get(2).sendKeys("Test2");
etc.
If those are not generated at runtime, you can give id's to all html elements(textboxes here) and use
.findElements(By.id)
method instead of
.findElements(By.xpath)
You must add parenthesis to your xpath, which should looks like this: (//input[#name='rowValue'])[?]
I want to use Android java "emulate" a browser and post Login data. I tried this How to submit HTML form data (method=POST) using JAVA
But I failed.....
url:http://192.168.254.34/Control?id=1000
Here are the html source:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>欢迎使用WLAN无线宽带</title>
<style><!--
a {text-decoration: none}
.f1 { font-size: 10.5pt; font-family: Verdana; line-height: 12pt }
.f2 { font-size: 8pt; font-family: Verdana; line-height: 12pt }
.btn {
BORDER-LEFT: #7b9ebd 1px solid;
BORDER-RIGHT: #7b9ebd 1px solid;
BORDER-TOP: #7b9ebd 1px solid;
BORDER-BOTTOM: #7b9ebd 1px solid;
PADDING-LEFT: 2px;
PADDING-RIGHT: 2px;
PADDING-TOP: 2px;
FONT-SIZE: 10.5pt;
CURSOR: hand;
COLOR: black;
FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#cecfde);
}
-->
</style>
<base href="http://192.168.254.34/pageset/131/PDA/">
</head><body topmargin="0" leftmargin="0">
<!-- 本地动态密码开始-->
<script>
function submitform2(){
if (form1.strAccount.value==""){
alert("请填入用户名!");
return;
}
form2.num.value=form1.strAccount.value;
form2.submit();
}
</script>
<iframe scr="about:blank" width="0" height="0" name="a"></iframe>
<FORM name="form2" method=post action="http://218.204.223.213:8080/cmpp/service.do?id=newuser" target="a">
<input size=12 type=hidden name="num" maxlength=26 style="border:1px solid #999999; FONT-SIZE: 10.5pt; BACKGROUND: #ffffff; COLOR: #333399; FONT-FAMILY: verdana; 1px:" size="14"></td>
<INPUT value="172.31.18.199" type=hidden name=ip>
</FORM>
<!-- 本地动态密码结束 --><form name=form1 method=post action="/Control?id=2000">
<center>
<table width=600 border=0 height=800>
<tr>
<td height=800>
<div align=center>
<center>
<table width=600 border=0 height=800 bgcolor=#FFFFFF cellspacing=0 cellpadding=0 style="border-collapse: collapse" bordercolor=#111111>
<tr>
<td height=800 width=600 background="a02.jpg" align="center">
<table border="0" width="288" cellspacing="0" cellpadding="0" height="97%">
<tr>
<td height="82" colspan="2">
<p align="center" class="f1">
</td>
</tr>
<tr>
<td height="295" align="center" colspan="2">
<table border="0" width="104%" cellspacing="0" cellpadding="0" height="106%">
<tr>
<td height="148" colspan="2">
<p align="center">
<font color="#333399" style="font-size: 10.5pt">
欢迎使用WLAN无线登陆页面</font></td>
</tr>
<tr>
<td width="32%" height="33" align="right" class="f1">
用户帐号</td>
<td height="33" width="68%">
<input name=strAccount maxlength=26 style="border:1px solid #999999; FONT-SIZE: 10.5pt; BACKGROUND: #ffffff; COLOR: #333399; FONT-FAMILY: verdana; 1px:" size="21"></td>
</tr>
<tr>
<td width="32%" align="right" class="f1">用户密码</td>
<td width="68%">
<input type=password name=strPassword maxlength=16 style="border:1px solid #999999; FONT-SIZE: 10.5pt; BACKGROUND: #ffffff; COLOR: #333399; FONT-FAMILY: verdana; 1px:" size="21"></td>
</tr>
<tr>
<td height="96" colspan="2" align="left">
<p align="center">
<input type="button" value="登 录" width="86" height="23" name="I1" onclick="javascript:form1.submit();" class="btn">
<input type="reset" value="重 置" width="86" height="23" name="I2" class="btn"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="f1" width="255">
<p align="center"> </td>
<td class="f1" width="33">
</td>
</tr>
<tr>
<td class="f1" height="91" width="255">
<p align="center" class="f1">
</td>
<td class="f1" height="91" width="33">
</td>
</tr>
<tr>
<td height="108" colspan="2">
<p align="center">
<br>
</td>
</tr>
</table>
</td>
</tr>
</table></center></div></td></tr></table></center></form></body></html>
the header I get:(use chrome)
Request URL:http://192.168.254.34/Control?id=2000
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:28
Content-Type:application/x-www-form-urlencoded
Cookie:JSESSIONID=45129DDCC372B780F65344DB9DB107FB
Host:192.168.254.34
Origin:http://192.168.254.34
Referer:http://192.168.254.34/Control?id=1000
User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1
Query String Parametersview URL encoded
id:2000
Form Dataview URL encoded
strAccount:username
strPassword:password
Response Headersview source
Cache-Control:no-cache
Content-Length:2202
Content-Type:text/html;charset=GBK
Date:Mon, 08 Aug 2011 11:04:25 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:No-cache
Server:Apache-Coyote/1.1
Set-Cookie:intPageSetID=131; Expires=Mon, 08-Aug-2011 11:04:55 GMT
anybody know how to post login data?????????
Here's how I do it:
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("www.server.com/dologin.php");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("username", "KennyStarfighter");
nameValuePairs.add(new BasicNameValuePair("password", "SecretPassword");
nameValuePairs.add(new BasicNameValuePair("redirect", "?controller=login&view=loggedonpage"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity he = response.getEntity();
Then I can for instance handle the response as XML.
xmlReader.parse(new InputSource(he.getContent()));
Use HttpClient. I can do the post and handle authentication. Doc here