When Safari is not running, I can open Safari by the following Automation JavaScript code.
safari = Application('Safari')
But when Safari is running and has no windows, the above code does not open Safari's new window.
I tried to add the following code.
window = safari.Window()
safari.windows.push(window)
But no effects.
How can I open new window of Safari by JavaScript Automation when Safari is running but has no windows?
Currently, I am using the following code
safari = Application('Safari')
safari.open(Path('~/dummy'))
I do not like it.