This article is a mirror article of machine translation, please click here to jump to the original article.

View: 6986|Reply: 4

[Source] [Practice] Use .NET to switch the URL of the Edge browser tab

[Copy link]
Posted on 5/29/2022 10:25:03 PM | | | |
Requirements: Get the URLs of all tabs of the current Edge and switch the URLs of the specified tabs according to the keywords. This article uses .NET programs to call the UI Automation API to implement functionality.

First, create a new .NET Framework Winform window program, which needs to be referencedUIAutomationClient.dllUIAutomationTypes.dllClass library, file location: C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0

It seems to help us reference the corresponding dll according to the assembly version, and the actual reference address is as follows:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\UIAutomationClient.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\UIAutomationTypes.dll
The main principle is to send keystroke data by searching for the UI tag name, if yesFor English operating systems, you can search for the keyword "Address and search bar"to find the UI element, but what is the keyword of the Chinese operating system?

You need to use the Inspect tool to find the element name, tool location: "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\inspect.exe"

It is recommended to use Inspect instead of UISpy, as with Inspect I was able to find the address bar. I switched to using the monitoring focus, then clicked on the address bar and Inspect to find it. Inspect is part of the Windows Toolkit and can be installed with the Windows 10 SDK.


Another difficulty is to create a URL in the address barSwitch to English input method, otherwise it cannot jump normally, the rendering is as follows:



The source code is as follows:

(End)





Previous:[Practical combat] The server builds LibreSpeed to test the network speed
Next:Practical Operation: Using Docker to Build DNS Service (dnsmasq)
 Landlord| Posted on 5/29/2022 10:48:28 PM |
 Landlord| Posted on 5/29/2022 10:58:49 PM |
UIAutomationClient related libraries can be referenced directly, as shown in the figure below:



Posted on 6/3/2022 10:53:37 PM |
Learn to learn...
Posted on 6/17/2022 9:31:59 AM |
Study, collect, and record
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com