Windows Application Driver handle windows explorer window - appium

I'm trying to automate a windows desktop application and everything is fine until in one of the steps in my application, I have to click on a "Browse" buttom that opens a windows explorer window to select an image and load it.
The thing is that I do not know how to make WinAppDriver focus in this new window, to be able to select the image and load it.
This is a part of the desktop application, and when sending click on Browse:

You probably need winappdriver to change its current handle to the one from the new explorer window. I'm not sure about the Python syntax, but in C# you do it like this:
driver.SwitchTo().Window(Driver.WindowHandles.Last());
The Last() function just selects the most recent added windowHandle.
Make sure you keep your previous window handle around, so you can switch back once the explorer window closes.
Also take a look at these posts. Its about webdriver but the functions are similar:
webdriver C#
webdruver java

Related

Visual Studio Professional 2019 version 16.10.0 Can't open .sql files in SSDT project

Upgrade VS 2019 Professional to latest version 16.10.0. Open an existing SSDT project, double-click on any sql script file in the project, the file can't be opened in a tab window.
If the sql script defines a table, I can see the message: The design surface is loading. I can see the separator between design and script surfaces. If I drag the separator to resize the surfaces, the window gets refreshed and the script will open correct.
If the sql script defines a view or stored procedure, I only see blank tab window. i don't see any messages.
If I restart the VS2019, the previous opened scripts are working fine. But still the same problem whenever I want to open a script which is not opened before the restart.
Here's a link to the root Microsoft tacked issue:
https://developercommunity.visualstudio.com/t/Visual-Studio-Pro-16100---Tabs-do-not-/1434964
A quick work around to force the editor to re-draw: resize the editor window by dragging the solution explorer re-size bar.
In VS 2019 Community 16.10, I can open one SQL file at a time. So if you shut all your open SQL files, you should be able to get a single one open.
Note: even uninstalling VS and starting with a clean install from the Microsoft site did not help.
Here's a link to the MS discussion of this topic:
https://developercommunity2.visualstudio.com/t/Cannot-see-content-of-sql-files/1437162?q=%5BVisual+Studio+2019+version+16.10%5D&ftype=problem&space=8&stateGroup=active&sort=newest
I was able to get two SQL windows open at the same time, though it is quite annoying: open both files and detach both from the documents frame so they float. Pick one and move it and size it where you want. The second will disappear as you do this, but never mind.
From the Window menu, select the second file. As you move it and size it, the first one will disappear.
Now select the invisible window from the Window menu. As long as you just move around and work within these two files, you should be able to keep them both open. So this is if you need to be looking at one view while you modify another, or some such thing.
For me, two is the limit. If I try three, only two will be visible.
This was a bug and seems to be fixed in the latest patch 16.10.2 - https://learn.microsoft.com/en-us/visualstudio/releases/2019/release-notes#--visual-studio-2019-version-16102-

execute swf in delphi7

I am trying to create something like a "preloader" in Delphi 7: when the user loads a file or executes a procedure that takes a while, I want to have an indicator that shows him that the procedure is working but he has to wait a bit.
I have in mind a loading bar or a spinning circle, if necessary without showing the percentage that has been loaded or the remaining percentage.
I created a spinning circle in flash but I can't find a way to use in Delphi 7.
I tried to call my swf "preloader" through an Animate Control but failed because it is only compatible with avi files.
I also downloaded a free spinning circle in .gif and tried to add it to my Delphi project in an Image Control but this also failed, because the image isn't compatible with gif format.
Is there any way to create this knd of "preloader" in Delphi or add one through an external swf or gif resource file ? How can this be implemented?
I use Flash Engine from Eugene Kryukov, but it is not on sale now.
Another solution would be to use Embedded Web Browser - EmbeddedWB, wich has support of swf from the box.
I have tried it right now, it works. But you'll have to have Internet explorer installed. The sample of usage: place the component on form and do this:
EmbeddedWB1.Navigate('C:\test.swf');
Another solution - you know, install component ActiveX:
1) Install flash
2) from delphi menu→Component→Import ActiveX Control
3) finsd in a list and select "Shockwave flash...", press "install" button
4) after it you'll see on the tab "ActiveX" the component ShackwaveFlash
5) in object inspector put the path and filename into "ShockwaveFlash1.Movie" property,
set ShockwaveFlash1.Loop and ShockwaveFlash1.Playing в true.
6) compile, run and enjoy.
After searching internet forums for many days I found the following solution.
First you have to have already installed Flash player (not the Flash web-designer of the Adobe suite).
If not then close Delphi and visit the Adobe's website. From there you should download the appropriate flash player according to your OS. After you have installed or if you already have installed Flash player then follow the below procedure:
Open Delphi and go to menu→Component→Import ActiveX Control. You will see a dialog box. Inside
this dialog box you will see a list of components. From this list search and find the
"Shockwave flash" component. Check it and press install. Then Delphi will ask you some questions
which you don't have to spend time, just press the "ok" button.
After finishing with the 3-4 dialog boxes, Delphi will eventually add a new component to the
"ActiveX" tab. Open Delphi and choose the "ActiveX" tab, you will see the "ShockwaveFlash"
component as the last control of this tab.
In order to use it Select this control and put it in a form. Give the appropriate dimensions
and the path and filename of the .swf (or .flv) file you want to play.
Set properties "play", "loop" to true if you want to make it play continuously or put "loop" to
false in order to make it play just once.
Be aware: Not all properties of the control work as they should. If for example you want through code your file to be visible or to hide at your will (e.g. on the press event of a button) then you will find out that the control does not follow your orders.

IWebBrowserDisp ole2 interface cannot open IE window to front of the screen

With Windows 7/8, this very nice ole2 interface IWebBrowserDisp is no more working properly, for some reason it now opens the IExplorer Window behind the actual currently running delphi application, not to the front of the screen as it used to be work earlier.
This makes the application to fail as user cannot see the opening web page without manually switching to Iexplorer and locating the correct window.
The code that I use to launch the link is:
WB : TEmbeddedWB;
wb.Navigate(URL,x,x,x,x);
This problem does not exist in older Windows or while I use my Delphi IDE ( I use Delphi4 and run it as ADMIN).

Right-click menu of EXE file

I was wondering if it was possible in Delphi to implement some items added to the right-click menu of an EXE file, specifically a Windows Service Application EXE which has not yet been registered or installed anywhere. The menu options would allow user to install/uninstall the EXE as a windows service. Is this possible? If so, then how? It's OK if it's only compatible with Windows Vista+.
There would be 2 menu items:
Install (or Uninstall)
Start (or Stop)
If you're referring to the Shell Context Menu (the right-click window in Windows Explorer), you cannot. You can add to the menu that will be displayed for all .exe files, but not for an individual one.
You could register a context menu handler for all executables, and then filter the filename passed to see if you needed to handle it or not, but this would mean that for every one of the hundreds (or thousands) of executable files on your machine, your filter would run on the slim chance it was your application that was right-clicked.
A possible workaround would be to put a file with a custom extension in your service's folder, and add a context menu handler for that file instead. When that file is right-clicked, the menu items would simply call your service with the appropriate command-line parameters.
(Of course, the best solution is to use the Control Panel's Services applet to manage your service, which is what it's designed specifically do do.)
It is possible, and you need to write shell extensions for Windows Explorer.
References:
http://delphi.about.com/library/bluc/text/uc071701a.htm
http://www.andreanolanusse.com/en/shell-extension-for-windows-32-bit-and-64-bit-with-delphi-xe2/
http://www.codeproject.com/Articles/441/The-Complete-Idiot-s-Guide-to-Writing-Shell-Extens

How do I add recent items to my program's jump list on the Windows 7 taskbar?

I'm using Delphi XE and would like to add "recent items" in the Windows 7 taskbar jump list for my application, like when right-clicking on Microsoft Word brings up recently opened documents.
I've found information on how to set the progress but nothing on jump-list items. Any help would be greatly appreciated.
This will happen automatically if, for instance, you only use the standard Windows file dialogs. At least my text editor, Rejbrand Text Editor, has got such a MRU list by Windows. It lists all files I have recently edited using Rejbrand Text Editor, even though I have not written any code at all for it.
I think that Windows observes the files you
open and save in your application by means of standard Windows file dialogs
open in your application by starting yourapp.exe <file name>, for instance by double-clicking a file that opens in your application
and automatically display these in the list.
If you want to control the task bar button and menu programmatically, you can use the Windows API. Delphi-specific examples are found in this blog post.
In my opinion the best way to do this is to make the following simple API call:
SHAddToRecentDocs(SHARD_PATH, PChar(FileName));
This not only deals with Windows 7 jump lists but also adds your file into the system's list of recently used documents which has an effect on early versions of Windows too.
Call the function whenever you open or save a file.
For your convenience, a link to the documentation of SHAddToRecentDocs().
Here are some resources that I have found useful when making my programs vista ready
http://code.google.com/p/theunknownones/wiki/TaskbarListComponents
http://www.installationexcellence.com/articles/VistaWithDelphi/Index.html
http://www.theabsolute.net/sware/delphivista.html

Resources