0

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???

k1dfr0std
  • 379
  • 1
  • 15
  • The new Edge (your old SO article is proababy about the old Edge) is actually quite good with UI Automation. I've just been testing with Inspect tool from Windows SDK (https://learn.microsoft.com/en-us/windows/win32/winauto/inspect-objects) and you can drill down everything, without any specific configuration – Simon Mourier Mar 04 '22 at 09:10
  • Same here. The Edge Chrome Automation support includes all elements in a page. Make sure you actually close the Edge Process, opening the `Settings and More` bar and selecting `Close Microsoft Edge`. If you just *click the X*, the Edge Process is not closed. Then start `edge://version/` to verify that the flags you have set are active. – Jimi Mar 04 '22 at 09:58
  • I love `Inspect.` With the version of Edge I'm forced to work with, everything was a `region` with `""` names and so many drillable points that led to nowhere! I did manage to make a little progress by changing the registry for `MSEdgeHTM\shell\command` from `--single-parameter %1` to `--force-renderer-accessibility %1` and I was able to drill further and begin to find things by name, but still has seemingly countless `regions` (as `LocalizedControlType`) so I'm really curious what is meant by "New Edge" vs "Old Edge" Based on my description, is this symptomatic of "Old Edge" behaviors? – k1dfr0std Mar 05 '22 at 04:12

1 Answers1

0

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 in Chrome still works in MSEdge.

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 the Chrome Legacy Window (counterintuitively) and then search for your element(s) within that pane. (FWIW, This also threw me off, because with Chrome, normally if I see this, I recall the flag not taking appropriately so I was reticent to click past this within Inspect.) /END TLDR

Without modifying my registry, I can find this Advanced button in the tree.

Advanced Button

It gives me a TON of errors as shown,, but the button is there, albeit the text from the page is not.

Errors, No Text shown from page.

If I change the registry setting, I get the text, but still get all the errors for the element.

Errors, and Text shown.

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!

No Errors, all text present

As to what @Jimi mentioned in the comment, I believe this issue with persisting MSEdge processes when clicking on the X button only occurs if the MSEdge 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!

k1dfr0std
  • 379
  • 1
  • 15
  • @YuZhou Thanks - I was mostly giving some time to others who may have a better insight than me in case there was any problems with the information I posted outside of my box - so far in my testing it seems to be legitimately working – k1dfr0std Mar 08 '22 at 04:46