如何通过终端关闭Chrome浏览器标签页? [英] How to close a chrome browser tab via terminal?

查看:437
本文介绍了如何通过终端关闭Chrome浏览器标签页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在编写一个调用chrome浏览器新实例的脚本.

Currently I am writing a script that invokes a new instance of the chrome browser.

我知道如何调用chrome在新标签页中打开*.html文档.

I know how to call chrome to open a *.html document in a new tab.

google-chrome *.html   

Chrome将打开一个新标签来显示该文件.

Chrome will open a new tab to show that file.

如何在不关闭其他选项卡或关闭浏览器窗口的情况下关闭终端中的选项卡?

How can I close the tab in terminal without closing other tabs or closing the browser window?

推荐答案

仅Linux答案:

only linux answer:

也许wmctrl会有所帮助.您可以使用-c选项正常关闭窗口:

Perhaps wmctrl could be of some assistance. You could use the -c option that closes a window gracefully:

wmctrl -c "tab title"

字符串chrome与窗口标题匹配.请注意,如果弹出某些消息(例如,当您打开多个标签时),则窗口可能不会关闭.

The string chrome is matched against the window titles. Note that the window might not close if some message pops-up (e.g. when you have multiple tabs open).

这篇关于如何通过终端关闭Chrome浏览器标签页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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