Process runs in console, but fails when generated as .exe
I am working with WinAutomation Version: 126.96.36.19954
This is the version issued by the company I work for, therefore would be unlikely for me to upgrade to the latest until they inform me to do so...
I have created a bot that reads data from an Excel file, stores it in a data table and then loops each line - inputting the data into a form.
The robot works fine when I run it directly in WinAutomation yet, when I compile it and generate a .exe file, the robot manages to input the first line of data, but then fails to find the text input control when it gets to the 2nd iteration.
Here is the error message I am seeing:
Error in function 'MyFunction' at action#7 'Populate Text Field In Window' Failed to write in TextBox (TextBox not found)
After lots of testing (checking the window is correctly selected and is in focus) I have found what I believe could be the problem...
To make sure i was selecting the correct input window, I decided to generate 2 random numbers and use these as coordinates which are used to move the selected window. This proves that the robot was correctly getting the right window.
When you run the robot within the WinAutomation console, The window is selected, it moves on screen, the first line of data is inputted/submitted, then, when the 2nd iteration executes, a duplicate/identical input window appears, it selects it and moves it and inputs/submits the data! On the 3rd iteration, the original window is selected and moves, data is inputted/submitted. On the 4th iteration, the duplicated window (that appeared on the 2nd iteration) is selected, the data is inputted/submitted and this alternating pattern continues until the loop ends.
When the .exe file runs, the input window is selected, it moves and the first line of data is inputted/submitted. When the code executes the 2nd iteration, a plain grey box appears - with no controls / buttons / inputs / text - nothing. It is selected and it moves, then that's when the error appears - obviously because it can't find any control within this grey box!
Why would this happen, and is there any steps I can take to prevent it / get the robot to work correctly!?
1. Did you place a wait for window or get window action, on the window, before executing the populate text box on window action ?
2. Is the Machine running the winautomation compiled exe, using the sane version of windows oper. system as the machine you developed the automation on ? .... Is the machine running the same version ff your windows app ?
3. Try adding wait 1 second after your wait window action or get window action.
4. Try add a Wait for window element on 1 element of of the window. ( use this, if item 3 - above worked, as better solution
.... Did one of the above apply to you and fix the issue ?
Hi, thanks for your reply, see my comments below:
1) I place a getWindow, followed by a focus window, followed by a wait for window to become focused
2) yes, I have made the bot using the software on my laptop, and am testing the generated .exe on the same laptop.
3) I have now added a wait 1 second, and this isn't working either
I am going to try adding a move mouse action to a specific coordinate on the screen, left click into the input box, and then use a send key to enter the input value.
I would suggest, adding a "Wait for window element", with element being the Input text box.
If it does not work, then I suggest you open a ticket with the support team.