复制链接到safari浏览器打开,如何从Safari浏览器获取网址

How can I access the Safari browser from C# to get the current URL? 解决方案 Its not exactly the best answer, but Ive accomp

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 that, there may be a sessions file that can be parsed using regular expressions

发布者:admin,转转请注明出处:http://www.yc00.com/web/1742568173a4460047.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信