WhatsApp Web does logout automatically. This happens after 30 minutes of inactivity. However, you can check a box under the QR code that says “keep me signed in” to stay signed in even after 30 minutes of inactivity. That way, you can log in whenever you wish, instead of automatically.