Prerequisites
- The OpenClaw browser is already started (profile=openclaw)
- The Jimeng page is already open or about to be opened
Login Detection
Determine whether Jimeng is already logged in:
- Not logged in: a "Log in" button is displayed at the bottom of the left sidebar
- Logged in: the user avatar and a "Subscribe" entry are displayed at the bottom of the left sidebar
Detection method: take a snapshot of the Jimeng page and look for the menuitem "登录" element. If it exists, the user is not logged in.
Login Flow
1. Agree to the agreement dialog
After clicking the "Log in" button, an "Agree to the agreement to proceed to login" dialog pops up.
Key pitfall: clicking the "Agree" button via aria-ref often times out. Use JS to click:
// snapshot 中按钮 ref 可能超时,改用 evaluate
() => {
const all = document.querySelectorAll('[role="dialog"] button');
const results = [];
all.forEach(el => results.push({ tag: el.tagName, text: el.textContent, class: el.className }));
return results;
}
After finding the button whose class contains agree-button :
() => {
const btn = document.querySelector('[class*="agree-button"]');
if (btn) { btn.click(); return 'clicked'; }
return 'not found';
}
2. Douyin OAuth QR code scan
After agreeing to the agreement, Jimeng willopen a new taband redirect to the Douyin authorization page at open.douyin.com (not an in-page popup).
Steps:
- Call
browser tabsto find the tab whose title contains "Douyin authorization" - Take a screenshot of that tab to obtain the QR code image
- Use the
messagetool to send the screenshot to the user (pass the local image path as themediaparameter) - Prompt the user to open the Douyin APP → tap Scan in the upper-left corner → scan the code to authorize
Note: clicking login multiple times will produce multiple Douyin authorization tabs; only take the latest one.
3. Wait for the user to scan the code and confirm
After the user scans the code, the Douyin authorization tab will automatically close/redirect, and the Jimeng main page will refresh to a logged-in state.
Verification method: take a screenshot of the Jimeng main page to confirm that "Log in" is no longer displayed in the lower-left corner, but rather the user avatar.
4. Login state persistence
The login state is automatically saved in the Chrome user-data directory:
~/.openclaw/browser/openclaw/user-data
The next time browser start profile=openclaw starts, the login is automatically maintained.
Optional: export cookies as a backup to memory/jimeng-cookies-backup.json:
() => { return document.cookie; }
FAQ
| Issue | Solution |
|---|---|
| "Agree" button aria-ref click times out | Use JS evaluate to click via a class selector |
| The page does not change after logging in | Refresh the Jimeng main page (navigate back to the original URL) |
| open_id cross app error | Use the message tool to send images rather than calling the Feishu API directly |
| Multiple Douyin authorization tabs | Use browser tabs to list them, operate only on the latest one, and close the extra ones |
| QR code expired | Close the Douyin authorization tab and click the Jimeng login button again |