prasmussen / chrome-cli

Control Google Chrome from the command line
MIT License
2.61k stars 89 forks source link

Sometimes Fails to Open Tab in Window, Url: chrome://newtab/ #68

Open malanmurphy opened 2 years ago

malanmurphy commented 2 years ago

chrome-cli: 1.8.0 macOS Catalina

I have a script that cycles through a list of bookmarked URLs and opens them in a particular window via chrome-cli. Sometimes everything works fine, but sometimes chrome-cli reports Loading: Yes with Url: chrome://newtab/ and just opens an empty tab in the specified window. It's completely random, I'm not able to reliably reproduce with the same URLs, same window IDs, etc, and on some systems I never see this problem and on some I see it every time. And sometimes when I receive a Url: chrome://newtab status I also see Loading: No but it's also completely random. The one repeatable detail is that chrome-cli will always return "Title: New Tab" for a tab that does not load the URL; for tabs when the URL does load successful Title: is always empty.

Here's example output of it failing; it opened 3 tabs correctly (#s 2, 3, and 5), and two opened as New Tab (#s 1 and 4). When I run this same script over and over again I will have different results with some URLs not opening on one run, opening successfully on another, etc. I've tried escaping the ?s in the URLs with shell escapes \? and HTML escapes ? with no change in chrome-cli behavior.

Opening Links 1 -> 5... Opening https://www.nugs.net/live-download-of-the-white-stripes-spaceland-los-angeles-ca-12-08-2000-mp3-flac-or-online-music-streaming/25846.html?cgid=ARTIST-674... Id: 899 Window id: 753 Title: New Tab Url: chrome://newtab/ Loading: Yes Opening https://www.nugs.net/live-download-of-the-white-stripes-the-troubadour-los-angeles-ca-07-16-2001-mp3-flac-or-online-music-streaming/28022.html?cgid=ARTIST-674... Id: 901 Window id: 753 Title: Url: https://www.nugs.net/live-download-of-the-white-stripes-the-troubadour-los-angeles-ca-07-16-2001-mp3-flac-or-online-music-streaming/28022.html?cgid=ARTIST-674 Loading: Yes Opening https://www.nugs.net/live-download-of-the-white-stripes-the-bottle-rocket-toledo-oh-04-20-2001-mp3-flac-or-online-music-streaming/27559.html?cgid=ARTIST-674... Id: 903 Window id: 753 Title: Url: https://www.nugs.net/live-download-of-the-white-stripes-the-bottle-rocket-toledo-oh-04-20-2001-mp3-flac-or-online-music-streaming/27559.html?cgid=ARTIST-674 Loading: Yes Opening https://www.nugs.net/live-download-of-the-white-stripes-the-troubadour-los-angeles-ca-07-17-2001-mp3-flac-or-online-music-streaming/27068.html?cgid=ARTIST-674... Id: 905 Window id: 753 Title: New Tab Url: chrome://newtab/ Loading: Yes Opening https://www.nugs.net/live-download-of-the-white-stripes-the-magic-stick-detroit-mi-03-31-2001-mp3-flac-or-online-music-streaming/27320.html?cgid=ARTIST-674... Id: 907 Window id: 753 Title: Url: https://www.nugs.net/live-download-of-the-white-stripes-the-magic-stick-detroit-mi-03-31-2001-mp3-flac-or-online-music-streaming/27320.html?cgid=ARTIST-674 Loading: Yes

Manually running it from the CLI with the same URL also produces the same randomness, opening the first one but not the second:

$ chrome-cli open https://www.nugs.net/live-download-of-the-white-stripes-spaceland-los-angeles-ca-12-08-2000-mp3-flac-or-online-music-streaming/25846.html\?cgid=ARTIST-674 -w 753 Id: 917 Window id: 753 Title: Url: https://www.nugs.net/live-download-of-the-white-stripes-spaceland-los-angeles-ca-12-08-2000-mp3-flac-or-online-music-streaming/25846.html?cgid=ARTIST-674 Loading: Yes

$ chrome-cli open https://www.nugs.net/live-download-of-the-white-stripes-spaceland-los-angeles-ca-12-08-2000-mp3-flac-or-online-music-streaming/25846.html\?cgid=ARTIST-674 -w 753 Id: 919 Window id: 753 Title: New Tab Url: chrome://newtab/ Loading: Yes

Same command, same URL, different result. Any thoughts?