WebDriver is not thread-safe. The issue of thread-safety isn't in your code but in the actual browser bindings. They all assume there will only be one command at a time (e.g. like a real user). But you can on the other hand instantiate one WebDriver instance for each thread but it will launch multiple browsers which will consume more memory.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…