最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Open a webpage popup window in Microsoft Edge browser using Python without Selenium - Stack Overflow

programmeradmin1浏览0评论

I can't use Selenium or any other type of option that controls the browser, because I need to use it on sites that have strict restrictions against bots and automations, so I need to use the browser itself as it is originally.

I currently use the following pattern code to open websites:

import webbrowser
url = f"/"
webbrowser.get("C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe %s").open(url)

With the web page already open in my browser, I have two extensions that I click to open the same window but as a pop-up, each extension has a different pop-up style, but both do not take up as much space as the browser's own options at the top of the page:

I would like to know if there is any way to specify in the Python code that I want to open as a pop-up or a normal tab so that I don't have to manually convert them using browser extensions.

I can't use Selenium or any other type of option that controls the browser, because I need to use it on sites that have strict restrictions against bots and automations, so I need to use the browser itself as it is originally.

I currently use the following pattern code to open websites:

import webbrowser
url = f"https://www.google/"
webbrowser.get("C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe %s").open(url)

With the web page already open in my browser, I have two extensions that I click to open the same window but as a pop-up, each extension has a different pop-up style, but both do not take up as much space as the browser's own options at the top of the page:

I would like to know if there is any way to specify in the Python code that I want to open as a pop-up or a normal tab so that I don't have to manually convert them using browser extensions.

Share Improve this question edited Mar 28 at 15:13 Digital Farmer asked Mar 28 at 15:00 Digital FarmerDigital Farmer 2,1796 gold badges25 silver badges98 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Yes, but with limitations. You can launch Microsoft Edge using Python’s webbrowser or subprocess, but to open a pop-up style window, you need to use Edge command-line arguments.

Use --app or --window-size flags for a minimal pop-up-like window.

Example using subprocess (more flexible than webbrowser):

# PYTHON

import subprocess

url = "https://www.google/"

edge_path = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"

# This creates a minimal window like a popup (no tabs, no address bar)

subprocess.Popen(\[edge_path, f'--app={url}'\])

What does --app= do?

  • It opens the URL as a web app window (no address bar, no tabs, no menu).

  • This is exactly what extensions like “Popup View” or “Open-as-Popup” do under the hood.

    Optional Extras:
    • You can control size and position:

      
      subprocess.Popen([
          edge_path,
          f'--app={url}',
          '--window-size=800,600',
          '--window-position=100,100'
      ])
      
      

      Summary

      TaskSolutionOpen in normal tabwebbrowser.get(...).open(url) Open in popup/app modeUse subprocess + --app= flagAvoid bot detection:
      ✅ Yes

      → This is indistinguishable from manual actionWorks with Edge extensions?
      ✅ Yes, browser is standard.

发布评论

评论列表(0)

  1. 暂无评论