Question

Here's the javascript for the button I'd like to click using mechanize:

<form id="fLogin" method="post">
<input type="button" id="qLogin" name="qLogin" value="Login" onclick="return submitfunction();" class="qloginb" />

it's not recognize as clickable by mechanize. Here is the code for "submitfunction()":

function submitfunction()
{       

    var form = document.getElementById("fLogin");


    form.action = "/someurl/etc" + "&val1=" + val1.value + "&id1=" + id.Value;


    form.submit();
 }

Is there a way to 'simulate' clicking this button? From what I've read, it looks like doing something like this might work: "br.form.action="the wanted action" but I'm not sure how exactly to implement this approach. Any help would be appreciated.

Was it helpful?

Solution

Was able to be logged in without using mechanize by constructing a URL from the form.action line and passing the login credentials in the query string:

http://www.example.com/someurl/etc?val1=somevalue&id1=someid&password=examplepassword&username=exampleusername

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top