Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Python以匿名模式打开Chrome页面_Python_Html_Google Chrome_Selenium Chromedriver_Incognito Mode - Fatal编程技术网

从Python以匿名模式打开Chrome页面

从Python以匿名模式打开Chrome页面,python,html,google-chrome,selenium-chromedriver,incognito-mode,Python,Html,Google Chrome,Selenium Chromedriver,Incognito Mode,关于这个问题有两个主题,但都不是针对mac的 如何在Mac电脑中以匿名模式使用Python打开网页 正常很容易 import webbrowser webbrowser.open('http://example.com') # Go to example.com 有些人编写了这样的代码,但这也适用于mac import webbrowser url = 'http://docs.python.org/' # MacOS chrome_path = 'open -a /Applicati

关于这个问题有两个主题,但都不是针对mac的

如何在Mac电脑中以匿名模式使用Python打开网页

正常很容易

import webbrowser

webbrowser.open('http://example.com')  # Go to example.com
有些人编写了这样的代码,但这也适用于mac

import webbrowser

url = 'http://docs.python.org/'

# MacOS
chrome_path = 'open -a /Applications/Google\ Chrome.app %s'
webbrowser.get(chrome_path).open(url)

有什么想法吗?

这里有几个解决方案,你确认没有一个能在mac上工作吗?@HymnsForDisco是的,我有。这里有一些应该能工作的命令的答案,你可以用python子进程模块执行它们。我想,如果我找到mac的chrome路径,我可以做,但我还找不到。像往常一样,堆栈交换似乎对此有更多的答案。我个人没有mac电脑要测试,但看看这个。