title: Why does this new window notification appear only when the user has manually pressed a button in a chromedriver instance? Selenium related
body: <p>I have a simple python program that opens <a href="https://opensea.io/" rel="nofollow noreferrer">this page</a> with <code>chromedriver.exe</code>, then it clicks on the wallet icon located at the top right corner of that page, for then clicking on the MetaMask wallet button, here:</p>
  <pre><code>from selenium import webdriver
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as EC
  from selenium.webdriver.common.by import By
  from selenium.webdriver.chrome.options import Options
  from selenium.webdriver.chrome.service import Service
  
  opt.add_argument('--user-data-dir='+r'C:\Users\ResetStoreX\AppData\Local\Google\Chrome\User Data') #Add the user data path as an argument in selenium Options
  opt.add_argument(&quot;--profile-directory=Default&quot;) #Add the profile directory as an argument in selenium Options
  s = Service(r'C:\Users\ResetStoreX\AppData\Local\Programs\Python\Python39\Scripts\chromedriver.exe') #Use the chrome driver located at the corresponding path  
  
  driver = webdriver.Chrome(service=s, options=opt) #execute the chromedriver.exe with the previous conditions
  driver.implicitly_wait(10)
  driver.get('https://opensea.io/') #go to the opensea main page.
  
  initial_page = driver.current_window_handle  #make the previous page the current one
  WebDriverWait(driver, 3).until(EC.element_to_be_clickable((By.XPATH, '//*[@id=&quot;__next&quot;]/div/div[1]/nav/ul/div[2]/li/button'))) #wait for the wallet button to be enabled for clicking
  wallet_button = driver.find_element(By.XPATH, '//*[@id=&quot;__next&quot;]/div/div[1]/nav/ul/div[2]/li/button')
  wallet_button.click() #click that wallet button
  #time.sleep(1)
  wallet_options = driver.find_elements(By.XPATH, &quot;//*[@data-testid='WalletSidebar--body']//li&quot;)
  for i in wallet_options:
      if &quot;MetaMask&quot; in i.get_attribute('innerText'): #find the MetaMask wallet button
          i.click() #click the MetaMask wallet button
  </code></pre>
  <p>The problem I noticed when testing this program was that after clicking the MetaMask wallet button via automation, the expected <code>Metamask Notification</code> window was never displayed, and the current window kept loading that button eternally as shown below:</p>
  <p><a href="https://i.stack.imgur.com/kwGuB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kwGuB.png" alt="problempreview1" /></a></p>
  <p>However, <strong>if the user manually clicked the same MetaMask wallet button</strong> in the same chrome instance, the <code>Metamask Notification</code> window would immediately appear as expected, asking the user to log in for then connecting the wallet to that site, as shown below:</p>
  <p><a href="https://i.stack.imgur.com/tXoVW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tXoVW.png" alt="expected_result1" /></a></p>
  <p>I even checked if there was another hidden window handle after pressing the MetaMask wallet button (via automation) with this code, but there was nothing else:</p>
  <pre><code>for handle in driver.window_handles:
              if handle != initial_page:
                  login_page = handle
                  driver.switch_to.window(login_page)
  </code></pre>
  <p>So, I'm confused, why does that button apparently only work when a user presses it but not when a program does? As always, I'd appreciate a lot if someone could explain what's happening and how could I fix this?</p>