UI 自动化无需通过 Selenium 即可导航 Microsoft Edge?
我正在为 VB.Net
中的 WPF
程序开发一些 UI 自动化
工作,并取得了巨大成功。 。 。直到尝试使网络浏览器自动化。
Chrome 中的 --force-renderer-accessibility
简直是天赐之物,但尽管是基于 Chromium 构建的,但他们似乎在 Microsoft Edge 上禁用了此标志。 。 。
他们有可能重新命名了国旗吗?还有人知道如何强制 Microsoft Edge 处于辅助功能模式吗?我看过这篇文章,但这似乎并不是真正的好的答案,也不是一个好问题(答案中的第一个链接已从 SO 中完全删除......)。
链接的SO文章中是否有使用WebDriver API的任何好的文档/示例,或者这是否指向Selenium???
I'm developing some UI Automation
work for a WPF
program in VB.Net
and have had great success. . . until trying to automate Web Browsers.
With Chrome there's --force-renderer-accessibility
which was a Godsend, but it appears despite having been built off of Chromium they've disabled this flag on Microsoft Edge. . .
is it possible they have renamed the flag? Anyone else know how to force Microsoft Edge to be in accessibility mode? I have looked at this SO Article but it seems this wasn't really a good answer, nor a good question (the first link in the answer has been removed from SO altogether. . . ).
Is there any good documentation/examples of using the WebDriver API from the linked SO Article, or does this point right back to Selenium???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有更多的时间来深入研究这个问题并进一步研究。我发现这篇文章(找到此类信息的奇怪地方)< /a> 并按照所述修改了我的注册表。我现在有 3 个场景让我感到困惑,但是在测试注册表更改之后,并且在使用
--force-renderer-accessibility
MSEdge 后> 标志(将我的注册表设置回原始设置以确认准确性后),我认为可以肯定地说,我们在Chrome
中喜爱的这个标志在MSEdge
中仍然有效代码>.TLDR:有什么区别?与 Chrome 相比,
MSEdge
将所有内容都埋在了 1,000 层深处,而"" 区域
条目确实让我感到困惑。您仍然希望查找Chrome 旧版窗口
(违反直觉),然后在该窗格中搜索您的元素。 (FWIW,这也让我感到困惑,因为使用Chrome
,通常如果我看到这个,我会记得该标志没有适当地采取,所以我不愿意在检查中点击它。)/END TLDR在不修改注册表的情况下,我可以在树中找到这个
高级
按钮。如图所示,它给了我很多错误,但是按钮在那里,尽管页面上的文本不在那里。
如果我更改注册表设置,我会收到文本,但仍会收到该元素的所有错误。
最后,如果我通过以下命令打开
MSEdge.exe
:start "Title for fun here" msedge.exe --force-renderer-accessibility "网址这里”
不仅会显示文本,还会显示我正在搜索的元素的信息!至于@Jimi在评论中提到的内容,我相信只有在单击
X
按钮时才会出现持续MSEdge
进程的问题如果MSEdge 性能提升
已启用。我曾在某个时候找到过一篇文章,但是随着我最近在尝试自动化 Edge 时遇到的所有搜索和疯狂的“哦,天哪,不,我必须跳到 Selenium?!?” 时刻,我已经把它丢在浏览器历史的沼泽里了。如果我再次找到它,我会在此答案中发布链接。如果有人有更好的方法在旗帜之外做同样的事情,请随时提供一些见解!
I have had some more time to dig into this and play a little further. I found this article (a bizarre place to find such information) and modified my registry as described. I have 3 scenarios now which I'm baffled by, but after testing the registry change, AND after re-running
MSEdge
from command line using the--force-renderer-accessibility
flag (after setting my registry back to the original setting to confirm accuracy), I think it is safe to say this same flag we have come to love inChrome
still works inMSEdge
.TLDR: The difference?
MSEdge
buries EVERYTHING in what feels like 1,000 layers DEEP compared to Chrome, and the"" region
entries REALLY threw me off. You want to still look for theChrome Legacy Window
(counterintuitively) and then search for your element(s) within that pane. (FWIW, This also threw me off, because withChrome
, normally if I see this, I recall the flag not taking appropriately so I was reticent to click past this within Inspect.) /END TLDRWithout modifying my registry, I can find this
Advanced
button in the tree.It gives me a TON of errors as shown,, but the button is there, albeit the text from the page is not.
If I change the registry setting, I get the text, but still get all the errors for the element.
Lastly, if I open
MSEdge.exe
via this command:start "Title for fun here" msedge.exe --force-renderer-accessibility "URL here"
not only will the text show up, but so will the information for the element I'm searching for!As to what @Jimi mentioned in the comment, I believe this issue with persisting
MSEdge
processes when clicking on theX
button only occurs if theMSEdge Performance Boost
is enabled. I had found an article at some point, but with all the searching and frantic "Oh goodness no, I have to jump to Selenium?!?" moments I've had recently with trying to automate Edge, I've lost it in the swamp of my browser history. If I find it again, I'll post the link in this answer.If anyone has a better way of doing this very same thing outside of the flag, please, feel free to give some insights!