<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bill Gates</title>
    <description>The latest articles on DEV Community by Bill Gates (@__14d14977650386).</description>
    <link>https://dev.to/__14d14977650386</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4121106%2F1357021d-76e2-421c-9e94-44462366b759.jpg</url>
      <title>DEV Community: Bill Gates</title>
      <link>https://dev.to/__14d14977650386</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/__14d14977650386"/>
    <language>en</language>
    <item>
      <title>How Selenium + Chrome Locked Me Out of My Own Windows Account</title>
      <dc:creator>Bill Gates</dc:creator>
      <pubDate>Fri, 11 Sep 2026 15:32:59 +0000</pubDate>
      <link>https://dev.to/__14d14977650386/how-selenium-chrome-locked-me-out-of-my-own-windows-account-5dmc</link>
      <guid>https://dev.to/__14d14977650386/how-selenium-chrome-locked-me-out-of-my-own-windows-account-5dmc</guid>
      <description>&lt;p&gt;I ran into one of those "bugs" that initially looks completely unrelated to your code.&lt;/p&gt;

&lt;p&gt;My Windows account started getting locked randomly.&lt;/p&gt;

&lt;p&gt;The weird part was that I knew the password was correct. Sometimes I could log in normally, and sometimes Windows would suddenly say that the account was locked.&lt;/p&gt;

&lt;p&gt;At first I assumed it was some Windows issue.&lt;/p&gt;

&lt;p&gt;It wasn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  The clue: Event ID 4625
&lt;/h2&gt;

&lt;p&gt;After checking the Windows Security event log, I found a large number of failed logon events:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="err"&gt;Event&lt;/span&gt; &lt;span class="py"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;4625&lt;/span&gt;
&lt;span class="py"&gt;TargetUserName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;John Doe&lt;/span&gt;
&lt;span class="py"&gt;LogonType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;2&lt;/span&gt;
&lt;span class="py"&gt;SubStatus&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;0xc000006a&lt;/span&gt;
&lt;span class="py"&gt;ProcessName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;C:&lt;/span&gt;&lt;span class="se"&gt;\P&lt;/span&gt;&lt;span class="s"&gt;rogram Files&lt;/span&gt;&lt;span class="se"&gt;\G&lt;/span&gt;&lt;span class="s"&gt;oogle&lt;/span&gt;&lt;span class="se"&gt;\C&lt;/span&gt;&lt;span class="s"&gt;hrome&lt;/span&gt;&lt;span class="se"&gt;\A&lt;/span&gt;&lt;span class="s"&gt;pplication&lt;/span&gt;&lt;span class="se"&gt;\c&lt;/span&gt;&lt;span class="s"&gt;hrome.exe&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;0xc000006a means that the authentication attempt failed because of an incorrect password.&lt;/p&gt;

&lt;p&gt;But the interesting part was this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ProcessName: chrome.exe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Chrome was generating failed Windows authentication attempts.&lt;/p&gt;

&lt;p&gt;And then I remembered what I was doing immediately after logging in: running a Selenium application that starts multiple Chrome instances in parallel.&lt;/p&gt;

&lt;h2&gt;
  
  
  What was actually happening
&lt;/h2&gt;

&lt;p&gt;By default, ChromeDriver creates a temporary Chrome profile for a Selenium session.&lt;/p&gt;

&lt;p&gt;Chrome has Windows-specific logic that may check the current user's authentication state. One of those checks can call the Windows LogonUser API using an empty password.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;DWORD&lt;/span&gt; &lt;span class="n"&gt;logon_result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="n"&gt;LogonUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;L"."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;L""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;LOGON32_LOGON_INTERACTIVE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="n"&gt;LOGON32_PROVIDER_DEFAULT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a Windows account with a real password, that authentication attempt fails. Normally this is mostly harmless. But my application was creating many independent Chrome instances.&lt;/p&gt;

&lt;p&gt;So effectively I had something like this: &lt;/p&gt;

&lt;p&gt;Start Selenium -&amp;gt; Create many ChromeDriver instances -&amp;gt; Create many fresh Chrome profiles -&amp;gt; Chrome performs Windows authentication checks -&amp;gt; Create many fresh Chrome profiles -&amp;gt; Chrome performs Windows authentication checks -&amp;gt; Windows records multiple failed logon attempts -&amp;gt; Account lockout threshold is reached&lt;/p&gt;

&lt;p&gt;So the funniest part of the bug was that my actual password was never wrong.&lt;/p&gt;

&lt;p&gt;Windows was locking me out because Chrome instances started by Selenium were generating failed authentication attempts in the background.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I confirmed it
&lt;/h2&gt;

&lt;p&gt;The Windows Security log contained batches of Event ID 4625 entries, all pointing to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chrome.exe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The timing also matched the moment my Selenium application started creating browser instances.&lt;/p&gt;

&lt;p&gt;You can check the current Windows lockout policy with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;net accounts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for the account lockout threshold.&lt;/p&gt;

&lt;p&gt;If the threshold is relatively low and your Selenium app starts many fresh Chrome profiles, you can hit it surprisingly quickly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Temporary workaround
&lt;/h2&gt;

&lt;p&gt;You can disable account lockout completely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;net accounts /lockoutthreshold:0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prevents Windows from locking the account after failed authentication attempts.&lt;/p&gt;

&lt;p&gt;I would treat this as a workaround, not necessarily the ideal permanent solution, since account lockout is also a security feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Better fix: reuse Chrome profiles
&lt;/h2&gt;

&lt;p&gt;Instead of letting ChromeDriver create a fresh temporary profile every time, give each Selenium worker its own persistent profile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ChromeOptions&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddArgument&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;$@"--user-data-dir=C:\SeleniumProfiles\Worker&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;workerIndex&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;driver&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ChromeDriver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For parallel execution, don't point every Chrome instance at the same profile.&lt;/p&gt;

&lt;p&gt;Use one persistent profile per worker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SeleniumProfiles/
    Worker0/
    Worker1/
    Worker2/
    Worker3/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This also has the nice side effect of avoiding repeated first-run initialization for every Selenium session.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;If Windows suddenly starts locking your account and you're running lots of Selenium/ChromeDriver instances, check Event Viewer before blaming your password.&lt;/p&gt;

</description>
      <category>selenium</category>
      <category>csharp</category>
    </item>
  </channel>
</rss>
