...
var
Header: ICefStringMultimap;
Data: ICefPostData;
request: ICefRequest;
begin
Header := TCefStringMultimapOwn.Create;
Header.Append('Content-Type', 'application/x-www-form-urlencoded');
Data := TCefPostDataRef.New;
Data.AddElement(CreateField('username=nameofuser'));
Data.AddElement(CreateField('&enc_password=#PWD_INSTAGRAM_BROWSER:10:1635078414:AdF...g=='));
request := TCefRequestRef.New;
request.Flags := UR_FLAG_NONE;
request.SetReferrer('https://www.instagram.com/accounts/login/', uCEFTypes.TCefReferrerPolicy.REFERRER_POLICY_NEVER_CLEAR_REFERRER);
request.Assign('https://www.instagram.com/accounts/login/ajax/', 'POST', Data, Header);
Chromium1.browser.MainFrame.LoadRequest(request);
end;
...
When the codes above executed, the respond is:
This page could not be loaded. If you have cookies disabled in your browser, or you are browsing in Private Mode, please try enabling cookies or turning off Private Mode, and then retrying your action.
The Asynchronous javascript (AJAX) call to
https://www.instagram.com/accounts/login/ajaxis a web service call into the back end made by code called on the login page. It is not a page to navigate the browser to on its own. It also does a lot of other setup for the call.If you inspect the normal web page operation using the developer tools available on modern browsers you can see what the web service responds with and it is not a webpage. It returns JSON which is easily consumed by Javascript code. For example on a call that fails to login due to both a user and password that are not valid it returns:
One method to automate web applications like this is to set element values and trigger events.