I'm using mech as part of a scrape of an HTML page that is driven by a hidden form that looks like this:
<form name="content" method="post" id="Form2">
<input type="hidden" size="-1" name="cid" id="Hidden5">
<input type="hidden" size="-1" name="cntid" id="Hidden6">
<input type="hidden" size="-1" name="attid" id="Hidden7">
Note it is a POST. The form content is set by in a link that looks like this
<a href="javascript:popContent('detail',1234,0,0);">Something</a>
The javascript itself looks like this
function popContent(action,cid,cntid,attid)
{
if (action == "detail")
{
document.content.cid.value = cid;
document.content.action = "detail.asp";
document.content.submit();
}
else
{
document.content.cid.value = cid;
document.content.cntid.value = cntid;
document.content.attid.value = attid;
document.content.action = "preview.aspx";
document.content.submit();
}
}
When the user clicks on the link what happens at the end of the day is that the POST equivalent of this GET happens
http://..../detail.asp?cid=1234&cntid=&attid=
Sooooo my question is how do I deal with detail.asp from within mech? I can set cid, etc. so all that is OK. But how do I deal with document.content.action = "detail.asp"?
My second question (I hope I'm allowed more than one) is how can I make a copy of the current mech to use so I don't step on the 1st mech's environment since I'll need it later. Like having two browsers going.
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.