- Tell me how to transfer the value of the login and password using WebBrowser in Internet Explorer, and then the program to press the input button.
- Tell me how to read the necessary data from the downloaded web page.
|
1 answer
The code for getting information from the element with the specified name and putting it into a variable
s:=form1.WebBrowser1.OleObject.Document.GetElementByID('имя нужного элемента').value; The code for putting data into the object with the specified name
form1.WebBrowser1.OleObject.Document.GetElementByID('имя нужного объекта').value:='то, что хотите туда поставить'; If the object does not have a name, for example in the following way you can click the submit button
for i := 0 to webbrowser1.OleObject.Document.forms.Item(0).elements.Length - 1 do if (webbrowser1.OleObject.Document.forms.Item(0).elements.Item(i).type='submit') then webbrowser1.OleObject.Document.forms.Item(0).elements.Item(i).click; In all cases, you must first find out what names the elements of the HTML page are of interest to you. To do this, open the source code of the html document and find these elements. You need the value of their ID attribute, or NAME. In the latter case, replace in Delphi code instead of GetElementByID - GetElementByName
- GetElementByID !!!!!! not GetElementByNAME, but GetElementByID, so you need to use not the name property of the element, but the id property - Vladyslav Matviienko
- In principle, both this and that method are possible, but now most people use GetElementByID - ikot
|