Hi,
I can make the script work and show the next page, where I am not working it is when I try to assign a different value to the fields :
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41:
| WebBrowser1.Navigate('http://snt-fraapg4.g.ap.lsy.fra.dlh.de/php/tks-upload-raw.html'); WHILE Webbrowser1.Busy DO BEGIN sleep(100); Application.ProcessMessages; END; showmessage ('ok'); ovElements := WebBrowser1.OleObject.Document.forms.item(0).elements; for i:= 0 to (WebBrowser1.OleObject.Document.forms.item(0).Length - 1) do begin showmessage (inttostr(i)+'-'+WebBrowser1.OleObject.Document.forms.item(0).item(i).tagName); showmessage (inttostr(i)+'-'+WebBrowser1.OleObject.Document.forms.item(0).item(i).type); showmessage (inttostr(i)+'-'+WebBrowser1.OleObject.Document.forms.item(0).item(i).value); end; for i := 0 to (ovElements.Length - 1) do begin if (WebBrowser1.OleObject.Document.forms.item(0).item(i).tagName = 'INPUT') and (WebBrowser1.OleObject.Document.forms.item(0).item(i).type='file') then WebBrowser1.OleObject.Document.forms.item(0).item(i).Value:='D:\test.txt'; end; tst:=OLeVariant('D:\test.txt'); showmessage (':'+tst); Ovelements.item(1).Value:=tst; for i := 0 to (ovElements.Length - 1) do begin showmessage (inttostr(i)+'-'+WebBrowser1.OleObject.Document.forms.item(0).item(i).tagName); showmessage (inttostr(i)+'-'+WebBrowser1.OleObject.Document.forms.item(0).item(i).type); showmessage (inttostr(i)+'-'+WebBrowser1.OleObject.Document.forms.item(0).item(i).value); end; for i := 0 to (ovElements.Length - 1) do begin if (WebBrowser1.OleObject.Document.forms.item(0).item(i).tagName = 'INPUT') and (WebBrowser1.OleObject.Document.forms.item(0).item(i).type = 'submit') and (WebBrowser1.OleObject.Document.forms.item(0).item(i).Value = 'Upload') then WebBrowser1.OleObject.Document.forms.item(0).item(i).Click; end; WHILE Webbrowser1.Busy DO BEGIN sleep(100); Application.ProcessMessages; END; |
I think in your case you only need to have the while busy, afterward you automatically get the next page.
Do you have any idea why the value of item 1 above is not set ?