Search code examples
delphiwhatsappchromium-embedded

How can I save a WhatsApp session using Delphi and Chromium?


I'm using the CEF3 2378.1280 branch and Delphi 10.1. I'm using the following code to save sessions:

var
    CookieManager: ICefCookieManager;

FromCreate:
    CookiesPath := ExtractFilePath(Application.ExeName) + 'cookies';
    CookieManager := TCefCookieManagerRef.Global(nil);
    CookieManager.SetStoragePath(CookiesPath, true, nil);

This code work fine with Facebook and a lot of other sites. But for web.whatsapp.com it can't save the session: After restarting the program, I must do tge QR-code validation again.

How can I save a WhatsApp session?


Solution

  • I'm sorry I asked you to move your question here. Usually, all questions that may have something to do with CEF bindings are redirected to their respective forums and this is a pure DCEF3 question.

    You don't need to specify a separate cookies directory. All you need is to set a cache directory using the 'CefCache' variable.

    The CEF3 2378.1280 branch is too old and that website may not support it. Upgrade to CEF3.2623 if you still need to support Windows XP and Vista, or upgrade to CEF3.3440 if you want the latest branch.

    If you decide to use CEF3.2623 you can use DCEF3 or OldCEF4Delphi. To use the latest branch you will have to use CEF4Delphi.