>> Also I should make clear that I'm also confused why that tutorial
doesn't work and also if there's anything special about complex
websites. For instance, the instagram website elements have many classes
with inscrutable names, and it's not clear which ones to use.
I personally would not create a tutorial based on a website that I didn't have control over. Any time the code / HTML on the website changes, there is a potential for locators to stop working. This can be even worse when the HTML is generated by front end dev frameworks, as JavaScript might generate a new ID each time the page is loaded, or other tools might create slightly different classes or structure each time a new build is created.
On top of that, in the case of large sites like Instagram, it's very possible that the company doesn't want to have people automate their website, and they could be actively employing measures that make automating their site more difficult. I would only try to automate an Instagram site if I worked for Instagram and was testing the site internally.
However, many companies provide APIs that allow access to data without having to use a browser, so that might be an avenue you could explore. I have no idea what Instagram offers as I don't use it.
>> So as I was fiddling around, I was getting zero feedback as to why my selectors didn't work... they just failed.
I usually get some kind of feedback that the element was not found at least. If an element not found exception comes back, that means that the selector, as written, was run and was unable to find anything that matches. That usually means that the selector is either invalid syntax or needs to be updated due to an underlying code / HTML change. Are you not getting back any error / exception information at all?
>> Also, the selector that was published in that example should by all
rights work... it exactly matches the button as far as I could tell. (It
uses nth-child, but it was pretty clear to me what that was doing.) But
it fails without any useful error message. And this is a published
tutorial, so I'm not sure when it stopped working.
You can use the browser console / tools to try out your selectors and make sure that they are working correctly. If it finds something, you should be able to see highlighting and feedback to show what is being found.
I see that you say it fails "without any *useful* error message" (emphasis mine). If you provide the error message, someone might be able to help you understand what it is trying to tell you.
As for this being a published tutorial, tutorials based on sites that can change after the tutorial is published often become untrustworthy before very long - you can learn concepts from them, but the specifics, like locators, are likely to become out of date very quickly as the site gets updated.
A quick search for "selenium writing good locators" turned up this article that you might find useful. It has, in my opinion, lots of useful information as well as some things I don't fully agree with personally, but you'll find over time that there are a lot of personal opinions and philosophical disagreements over things like best practices when it comes to Selenium. In many cases, it comes down to the specifics of the site and people you're interacting with.
Good luck!