title: How to find element element which is present in extension popup
body: <p>I am trying to automate Dapp with phantom using selenium webdriver
  I am using a multiwindow handler but unfortunately, my code is giving me only 1 window, it is not considering a Phantom wallet as a separate tab or window.
  I want to click on connect button but i am not able to connect even it is not considering this popup as a separate window or tab</p>
  <pre><code>@Test
  
      public void Phantom() 
      {
          ChromeOptions opt = new ChromeOptions();
          opt.addExtensions(new File(&quot;phantom.crx&quot;));
          System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;chromedriver.exe&quot;);
          WebDriver driver = new ChromeDriver(opt);
          driver.get(&quot;url&quot;);
          String parent=driver.getWindowHandle();
           
          // This will return the number of windows opened by Webdriver and will return Set of St//rings
           Set &lt;String&gt;s1=driver.getWindowHandles();
           
          // Now we will iterate using Iterator
          Iterator&lt;String&gt; I1= s1.iterator();
           
          while(I1.hasNext())
          {
           
             String child_window=I1.next();
           
          // Here we will compare if parent window is not equal to child window then we            will close
           
          if(!parent.equals(child_window))
          {
          driver.switchTo().window(child_window);
          driver.findElement(By.xpath(&quot;//*[@id=\&quot;root\&quot;]/main/div/div/section/button[2]&quot;)).click();
           driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS) ;
          driver.findElement(By.xpath(&quot;//*[@id=\&quot;root\&quot;]/main/div[2]/div/form/div[1]/div/section/div/textarea&quot;)).sendKeys(&quot;phrase&quot;);
          driver.findElement(By.xpath(&quot;//*[@id='root']/main/div[2]/div/form/div[2]/button&quot;)).click();  
           driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS) ;
          driver.findElement(By.xpath(&quot;//*[@id=\&quot;root\&quot;]/main/div[2]/div/div/button&quot;)).click(); 
          driver.findElement(By.xpath(&quot;//*[@id='root']/main/div[2]/div/form/div[1]/div/section/input&quot;)).sendKeys(&quot;password&quot;);
          driver.findElement(By.xpath(&quot;//*[@id='root']/main/div[2]/div/form/div[1]/div/section/div[1]/input&quot;)).sendKeys(&quot;password&quot;);
          driver.findElement(By.xpath(&quot;//*[@id=\&quot;root\&quot;]/main/div[2]/div/form/div[1]/div/section/div[2]/span/input&quot;)).click(); 
          driver.findElement(By.xpath(&quot;//*[@id=\&quot;root\&quot;]/main/div[2]/div/form/div[2]/button&quot;)).click(); 
          driver.findElement(By.xpath(&quot;//*[@id=\&quot;root\&quot;]/main/div[2]/div/div[2]/button&quot;)).click(); 
          driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS) ;
          driver.findElement(By.xpath(&quot;/html/body/div/main/div[2]/div/div[2]/button&quot;)).click(); 
          driver.close();
          // once all pop up closed now switch to parent window
          driver.switchTo().window(parent);
          //close the parent window
          driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS) ;
          driver.findElement(By.xpath(&quot;//*[@id=\&quot;manu-box\&quot;]/div[1]/div/div/div/div[2]/div[2]/button&quot;)).click(); 
          driver.findElement(By.xpath(&quot;//*[@id=\&quot;uncontrolled-tab-example-tabpane-sol\&quot;]/div/div[3]/div/div[1]/div&quot;)).click(); 
  //  //at this point there is no focused window, we have to explicitly switch back to some window.
          
      
  
      }
          
  
          }
          String wallet1= driver.getWindowHandle();
          Set &lt;String&gt; all=driver.getWindowHandles();
          
          System.out.println(&quot;No. of windows&quot; + all.size());
              
          
  }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/fLFBZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fLFBZ.png" alt="enter image description here" /></a></p>