How can I access theSafari browser from C# to get the current URL?解决方案It's not exactly the best answer, but I've accomplished this by bringing focus to thesafari window, and then using SendKeys ...
How can I access the Safari browser from C# to get the current URL?
解决方案
It's not exactly the best answer, but I've accomplished this by bringing focus to the safari window, and then using SendKeys to send a "Ctrl + l" which selects the URL Bar, "Ctrl + C" which copys the contents to the clipboard. Then grab the contents of the clipboard and save it to a string, or you can save it to a list of strings, and bring focus back to the window, "Ctrl + Tab" , Repeat above process. This would of course require that you allow the program to do its job, and you may also want to put a slight delay in between iterations of that loop. SendKeys is not a good solution, but it does work if you allow for sufficient delay and provision for activating focus on each iteration of the loop. Other than th