The reason is that Firefox doesn’t have the scripting interface and isn’t suitable even for GUI scripting. Its AppleScript dictionary is very rudimentary and contains only the Standard and Definitions Suites. However, you can open web-pages in it by using the open location command belonging to Standard Additions and, hence, it’s available globally. Just so happened that today I replied to a post raising a similar problem. Please, have a look. Although it concerns the usage of the clipboard its skeleton fits the purpose.
I found it very odd that my code from post #2 didn’t work for the OP with FireFox. Therefore, I took the trouble to install FireFox on my computer.
Result: the script perfectly opens the given URL. I ran the script several times to be sure. The “Welcome” page appeared only when I first opened FireFox. As it should be with a decent application.
I don’t know why the OP has a different answer. Perhaps the site server had some kind of glitch yesterday. Or, maybe, yesterday its trusted sertificat was expired and now it works again. No need keystrokes and GUI scripting. Code tested:
tell application "Firefox"
«event WWW!OURL» theWebPage
GUI scripting is more justified because Firefox is wonky itself and clumsy responding to AppleScript in general. At least, this is what I see on my set-up. More often than not when activating Firefox clamps down on the URL I send loading only a default page. No sooner than after some time it begins responding to commands again which is not what the behaviour is in Safari. It’s completely unpredictable and I suspect this was the culprit of OP issues with this command which is what I experienced too when I ran it. And, BTW, raw codes is very unintuitive; the use is poorly documented so relying on GUI scripting is more friendly at this point. My code works 100/100.
An additional option FWIW. I don’t have Firefox installed but it works with Safari and I would expect it to work with Firefox.
set theBrowser to "/Applications/Safari.app/" -- change to path to Firefox
set theWebSite to "https://google.com"
do shell script "open -a " & quoted form of theBrowser & " " & quoted form of theWebSite
I have a confession to make here. I retried this morning with FireFox and got exactly the same result as you (“Welcome” page when first opened, but expected result the second time).
Morals of the story : You need to have FireFox opened before launching your script.
In my initial trials before posting this question, I expected the script to “do it all by itself” and always quitted Firefox before retrying.
Anyway, thanks for answering my silly newbie question.
Damn it. I couldn’t get my script to open the “Wecome” page like yours. You did not understand me. This page appeared to me only for the very, very first time after installation. With any other launches, it opens the site you need, successfully.
I can’t figure out why you get it every time you open Firefox. Check your Firefox settings. Or restore defaults.