如何在Python中以隐身模式打开Chrome [英] how to open chrome in incognito mode from Python

查看:550
本文介绍了如何在Python中以隐身模式打开Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可以在PowerShell中运行:

 启动过程chrome.exe -ArgumentList @('-incogn','www .foo.com')

Python如何实现?

解决方案使用 os 模块执行命令。

  import os 
os.system(C:\ Program Files(x86)\Google\Chrome\Application\chrome.exe -ArgumentList @('-incognito','www.foo.com')

有关 os.system 可以找到 here


This works, in powershell:

Start-Process chrome.exe -ArgumentList @( '-incognito', 'www.foo.com' )

How can this be achieved from Python?

解决方案

Use the os module to execute the command.

import os
os.system("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -ArgumentList @( '-incognito', 'www.foo.com'" )

More information on os.system can be found here.

这篇关于如何在Python中以隐身模式打开Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆