I am trying to log in (to perform some routine tasks) into a webpage (www.soccerproject.com) and i am unable to do it since the submit buttons class is "superbutton" which doesnt have the click() handler, or an ID to begin with.i tried to execute the JavaScript bound to the onClick method of the button but it didnt work, so here is my code and i will be thankful if someone could provide some help.
procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate('http://www.soccerproject.com/spnewl_index.php');
end;
procedure TForm1.WebBrowser1DocumentComplete(ASender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var ii:integer ;
begin
if (WebBrowser1.LocationURL='http://www.soccerproject.com/spnewl_index.php') and (i<4) then inc(i);
if i=4 then begin
WebBrowser1.OleObject.Document.getElementById('login').setAttribute('value', Edit1.Text);
WebBrowser1.OleObject.Document.getElementById('password').setAttribute('value', Edit2.Text);
wait(200);
WebBrowser1.OleObject.Document.forms[0].submit();
WebBrowser1.Navigate('http://www.soccerproject.com/#');
end;
end;
the reason i count to 4 is that thats the time the webBrowser needs to fully load and display the website (to be able to fill in the text). Also, the wait() function simply waits 200 milliseconds (just to be sure). Thanks in advance