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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值