Simple Chrome extension w/ Context Menu cmds that call VB .net procedures - vb.net

I'm looking for some input on how feasible it would be to create a Chrome extension that, when activated via toolbar button, adds context menu commands that call procedures (or methods of a class) written in VB.net.
That's pretty much it. At this point, i'd be thrilled to see context menu items that simply display message boxes built in VB.net.
I'm starting with Chrome, but would anticipate replicating similar functionality in other browsers, starting with Edge or IE, then Firefox and possibly Safari. If it's easier to start with another widely used browser besides Chrome, i'd be fine with that.
I've done the obvious google searches, and I can't seem to find an easy-ish place to start. Any ideas?
--edit, just an additional note, the VB.net procedures would be contained in a dll, exe, or other container installed on the client side machine. I'm not trying to execute server side code

Related

Can you make a keyboard shortcut to select a button on a website?

This question is mostly just out of curiosity at what's possible. I'm interested to know any ideas at all.
If I'm on a website, is it possible to make a keyboard shortcut for clicking a button on that site? For example, if I'm on google.com, is it possible to write a script somewhere on my own system that will detect that I'm on google.com and make it so that if I press ctrl-g while that site is in focus, it will click Google Search?
If you know for sure that this isn't possible and have an explanation for why, I'd be interested to know that too.
Yes, it's possible.
I'll briefly describe how to do it in C# and Chrome, but it's not language-dependent and could be used in Edge or IE either.
Get the currently focused window by calling GetForegroundWindow API.
Get the process id by calling the GetWindowThreadProcessId API.
Get the process name by process id.
Proceed if it's Chrome.
Get access to UI Automation COM interface.
You will need to consume the COM interface in your language, but in C# it's quite easy: you'll need to add a reference to COM -> UIAutomationClient to your project. This will generate a wrapper for you, so the COM interface will be accessible in the code in a usual OO-style.
In Chrome, the Accessibility options must be enabled first to get access to UIA.
It could be done manually by navigating to chrome://accessibility/, but it's possible to do it programmatically as well.
Use UI Automation to detect the active URL.
You will need to find the Address bar in the UI tree using UIA by its Name or ClassName or another unique identifier.
You could first retrieve the UI Automation element for the Chrome window and then use the FindAll method to find the Address bar in the subtree to get its Value property which should contain the current URL.
Inspect tool will help you to investigate the Chrome UIA element tree and element properties (like Name or ClassName).
Do the same steps to find the Google Search button in the UI tree using UIA.
Call GetClickablePoint method to get its clickable point.
Click on the button programmatically using Win API.
To do this on a global shortcut, you could place a keyboard hook by calling SetWindowsHookEx API. Or use a library.
Here is another way.
That's it, easier than it looks.

How to generate Domino dialogboxes on traditional (non-xpages) webforms

I want to have a popup/dialogbox with an "OK" button on it that will close the dialogbox...after someone performs a task on a Domino webform. I know I used overlays in xpages before, but the current application I am maintaining was built with traditional Domino forms (lots of pass-thru HTML) and my initial attempt to build an overlay effect did not work.
I have tried using javascript code of:
var window = window.open(url, windowName, [windowFeatures]);
...but this has not been successful. No errors in debug, yet my url page does not pop up. I am hoping someone might be able to provide a snippet of what you use so I can see where I am going wrong.
The url parameter I am passing is correct, as I used an alert to show me what was going in there, but I am doing something basic wrong.
If I can answer any questions for you I can do that as well.
Thank you
The only way I know to display a dialog box in a classic Domino web application is to do just like you would on any HTML-based webpage. Either you create your own popup functionality, or you use one of the many plugins available.
When I work with classic Domino web applications, I have often added Bootstrap to it, to make things look a bit better. Then I can use either the native Bootstrap dialog boxes, or a plug-in called Bootbox.js. But there are many other ones.

Initialize UIautomation tree from an element whose ClassName is Chrome_RenderWidgetHostHWND. Accessability Insights

I need for get UIelements using "UIautomation" technology from another programms in windows OS.
Some programms has "chrome-like" browsers for content rendering.
The methods are get element (like c# AutomationElement.FromPoint / FindAll) return browser element with ClassName "Chrome_RenderWidgetHostHWND" and Name like a "Chrome Legacy Window". But i need the content elements in that browser.
I found out that, programm "Accessibility Insights" can do it!
Run application, "Microsoft Teams", for example
Run "Accessibility Insights"
Move mouse on "Microsoft Teams", we get "Chrome Legacy Window"
After any mouse click (left/right) on target programm ("Microsoft Teams") provoke rebuild UI tree
Then UIautomation technology can get all inner UI elements in browser.
"Accessibility Insights" source code is https://github.com/microsoft/accessibility-insights-windows
I studied it very carefully, but not found code, that provide rebuilding (or, initializing?) inner UI elements.
Any one can help me?
What i should to do for win my task - get inner UI elements in chrome-like browsers at another programm on windows OS?
If you've read to the end, thank you
Accessibility Insights for Windows doesn't interact directly with the UI Automation system. It builds on Axe.Windows (Source code), which queries and exposes the UI Automation properties. In the case you're describing, Axe.Windows is walking the UI Automation tree in response to a UIA_AutomationFocusChangedEventId message from the UI Automation framework. That notification gets handled by the onFocusChangedEventForSelectingElement method of FocusTracker.cs. Hopefully that will be enough to get you started.
--Dave Tryon (Accessibility Insights team)

Functional tests for office-js Excel addin (Selenium?)

We develop office-js based addin for Excel and we've come to a place where we want to write automated functional tests (preferably with Selenium) for desktop version of Excel on Windows.
First issue we've encountered was that different combinations of Excel/Windows use either IE/Edge's webview underneath. Let's let IE die and assume we just need to test with Edge webview (EdgeHTML, as Edge-chromium webview is not yet released).
So the main issue is: we cannot (or don't know how to) connect addin's webview with Selenium, because we're not responsible for launching webview's process - it's launched by Excel itself. Is there any recommended way to run functional tests for desktop version of Excel with addin inside? We can control Excel itself through COM, so that's not an issue. But how to control the webview underneath addin?
We've tried WinAppDriver, but it gives windows-specific XML of generated window, not addin's HTML we'd like to see, making navigation and assertions fragile and complicated.
I think we searched just everywhere and couldn't find any pretty solution, so dirty hacks are also allowed, as long as they will work reliably and not too slow.

Mercury Quick Test Pro and Virtual machines: Works from one client machine but not another

I have a virtual machine (VMware) with Mercury Quick Test Professional 9.2 installed. I have a script to test an application, written in VB.NET using the Infragistics library.
If I access this virtual machine using my laptop (using Remote Desktop), everything works fine, the script completes without a problem. My laptop runs XP, with Windows Classic theme.
If I access this virtual machine using another machine (using Remote Desktop), the script starts fine, but stops halfway through, without no error message from QTP, nothing. This machine runs XP, with Windows Classic theme.
One difference between the two setups is the size of the screen, the laptop is 1920x1280, other machine 1280x1024.
The step where the script stops involves checking a checkbox within an UltraWinGrid. The checkbox itself is displayed, is on the screen in both cases.
Has anyone had this problem before, or have any idea why the behaviour is different between the two machines?
Thanks.
OK. I've found the problem. In fact, the script was failing silently because that's what the person who wrote the script told it to do. It couldn't validate something which was off screen, so the script failed.
The problem was the QTP definition of 'off screen'. I have two screens attached to my laptop, the screen for the laptop itself (1920x1200) and another screen (1280x1024). I connect to the VM for QTP using remote desktop, and it uses the settings of the screen for the laptop. This means that when I launch my QTP script, and move it to the other screen, it doesn't fit, so the screen is no longer maximized, and the object is partially off screen, so can't be found.
The fix is simple: in the Remote Desktop, use the Display tab, and set the size of the screen to a size to 1280x1024, and QTP doesn't have any more problems.
VoilĂ .
If you are not using Expert Mode, and / or are allowing QTP to do most of the work to create your repository objects, then yes it is referencing everything by pixels.
I create all of my repository objects by hand, viewing the source (in the case of automated web-application testing) and using the Object Spy for assistance where needed. I make a point to not have any positioning information as part of my object definition, for the very reason you are running in to.
For the parts of my web-app that interacted with Windows (opening a file to upload, etc.) the Object Spy was essential for the trial and error necessary to create a unique identifier for creating the repository object. But it can be done.
Ex1: File Browse Dialog
text = "Choose file"
nativeclass = #32770 (apparently some Windows VooDoo for a file open dialog?)
Ex2: Filename textbox in Browse dialog:
nativeclass = "Edit"
attached text "File &name:" (more Windows VooDoo? It woudn't work for me without the "&")
Ex3: Open Button in the dialog:
text = "&Open"
object class = "Button"
Good Luck!
Point of clarification: You mentioned that QTP stops with no error message. Does that also mean that the test results log file also has no error message? If the log has any information, that may be helpful in diagnosing the problem. Could you share the lines of code at the point where the script fails?
Also, remote desktop will resize the desktop on the remote machine. Although QTP scripts are not inherently coordinate based, individual statements can be coordinate-based relative to an object. The resolution could be an issue in that regard. For example, imagine you had a line like Button.Click(5, 150) recorded on a higher resolution machine. But if you attempted to play it back on a lower resolution machine, and the 150 is out of bounds of the object on the lower resolution, it could cause an issue.
QTP does not use screen coordinates except as a last resort, if the objects are identified as high level objects (SwfTable in this case) you should be OK, if however QTP doesn't recognise the object it falls back to WinObject and screen coordinates.
If you're using Infragistics then you should know that they extend QTP's support with their TestAdvantage product which will probably solve your issue.
Edit:
#MatthieuF said:
In fact, we use the Infragistics plugin for QTP, and we still have the problem
Can you give me an example of a line that fails?
A few things:
You should be able to debug on the VM easily - just wait for it to stop, go into your object repository, and see if it can identify the object. If no then use object spy to figure out what properties are different between the OSes. If there is a difference then you can always set that property to a regular expression and have it check for both possibilities.
Assuming that isn't the issue we've run into problems using remote desktop with QTP if the Remote window is closed or minimized. For us, it was an issue where the clipboard can not be changed when an RDP window isn't visible, but there could be other surprises when using QTP that way.