Troubleshooting
This guide covers common issues and solutions when using BotManager Browser Agent.
Common Issues
BotManager Object Not Loaded
Symptoms: window.BotManager is undefined.
Causes:
- Script has not been loaded yet.
- Script path is incorrect.
- Network error occurred.
Solutions:
- Check script loading:
// Check script loading
if (typeof window.BotManager === 'undefined') {
console.error('BotManager is not loaded.');
}
- Check script path:
<!-- Check correct script path -->
<script src="{{ AGENT_URL }}/agents/client/javascript/botmanager-browser-agent.js" async></script>
- Check script loading in Network tab:
- In the browser developer tools Network tab, check if the
botmanager-browser-agent.jsfile was successfully loaded.
- In the browser developer tools Network tab, check if the
detectPage Function Not Working
Symptoms: No response when calling BotManager.detectPage().
Causes:
- BotManager object has not been initialized yet.
- Script is loaded asynchronously and is not ready yet.
Solutions:
// Wait for script to load before using
function waitForBotManager(callback) {
if (window.BotManager && typeof window.BotManager.detectPage === 'function') {
callback();
} else {
setTimeout(() => waitForBotManager(callback), 100);
}
}
waitForBotManager(() => {
BotManager.detectPage('/api/login-endpoint', (result) => {
performLogin();
});
});
Detection Request Not Sent
Symptoms: Auto detection does not work when the page loads.
Causes:
cfg.detectOnLoadis set tofalse.- Network timeout occurred.
Solutions:
- Check configuration:
// Check detectOnLoad configuration
(function(cfg) {
cfg.detectOnLoad = true; // Enable auto detection
})(window['BotManager-config'] || (window['BotManager-config'] = {}));
- Increase network timeout:
cfg.networkTimeout = 5000; // Increase timeout time
Server-Side Agent Integration Not Working
Symptoms: Server sent x-botmanager-location header but redirection does not occur.
Causes:
- Browser Agent is not loaded.
- Header name is incorrect (case-sensitive).
Solutions:
- Check Browser Agent loading:
if (window.BotManager) {
console.log('Browser Agent is loaded.');
}
- Check header name:
- Server must send the header as
x-botmanager-location(lowercase).
- Server must send the header as
Developer Tools Detection Not Working
Symptoms: Developer tools are not detected when opened.
Causes:
cfg.detectDevToolsis set tofalse.
Solutions:
cfg.detectDevTools = true; // Enable developer tools detection
Additional Support
If the issue is not resolved, check the following:
- Check error messages in browser console
- Check requests/responses in Network tab
- Check configuration in BotManager console