Closed sarosini closed 11 years ago
Which adapter are you using, :win_32
or :ms_uia
?
In my experience (using the :ms_uia
adapter) the CI server will need you to have an interactive desktop session. I use TeamCity for our CI but rather than installing the build agents as Windows services I have them in the startup script and the machine to auto-login.
Thanks for the quick response.
@adapter=:win_32
Yes, my main problem is the interactive desktop session. Since my server is on a VMware, that desktop interactive is not happening.
Whereas, if I logged into that VMware, I am not facing any problem.
Maybe solution in #28 will help you?
It's possible that the monkey patch needs a little changes, but the general idea should be the same. In short these 3 lines should be removed: https://github.com/jarmo/RAutomation/blob/master/lib/rautomation/adapter/win_32/control.rb#L34-L36
Let us know if that solves your issue too.
@sarosini I'm running our CI within VMWare as well, I just have the machine auto-login. Maybe that's not an option for you if it's a Windows Server machine? My build agents for TeamCity are Windows 7 VMs (with VMWare) that auto-login and it is working for us.
@leviwilson Yes its a windows machine.We are using Jenkins for continuous integration as standard process so changing to Team-city is not a ideal solution.
@jarmo Bad luck for me :)
I also have tried the solution mentioned in https://github.com/jarmo/RAutomation/issues/28, but it is also not working....Here is the change of code snippet I have tried:
def click assert_enabled clicked = false wait_until do hwnd = Functions.control_hwnd(@window.hwnd, @locators) if hwnd Functions.control_click(hwnd) && clicked = true # is clicked at least once end block_given? ? yield : clicked && !exist? end end
@sarosini I'm not suggesting switching to TeamCity, I'm suggesting you setup your CI machine to auto-login and launch Jenkins that way. If you currently have Jenkins to run as a Windows Service, that will not work either since services cannot interact with the desktop.
@leviwilson Could you please help me, on how to setup that auto-login and launch Jenkins in widows box? I will give a try.
Moreover, we can also setup any particular services to interact with desktop by enabling an option "Allow interact with desktop" in services administrator, but in this case, I am not able to grab the windows service name for file upload dialog box.
@leviwilson we have not configured our Jenkins as windows service by the way
I've not done so (with Jenkins) but it looks like there are some suggestions here.
@jarmo Any updates on my issue? Looking forward to your reply
Can you show the backtrace and the code you were using while getting the error message?
Error backtrack:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.9.2/lib/rautomation/wait_helpe
r.rb:20:in `wait_until': timed out after 60 seconds (RAutomation::WaitHelper::Ti
meoutError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.9.2/lib/rautomati
on/adapter/win_32/text_field.rb:15:in `set'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.9.2/lib/rautomati
on/text_field.rb:16:in `set'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.32.1/lib/s
elenium/webdriver/common/target_locator.rb:37:in `window'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.4.1/lib/watir
-webdriver/window.rb:99:in `use'
Code I am using:
Control.rb: I have commented out those three lines, so my exact def click function under Control.rb is the following:
def click
assert_enabled
clicked = false
wait_until do
# @window.activate
# @window.active? &&
# focus &&
Functions.control_click(hwnd) &&
clicked = true # is clicked at least once
block_given? ? yield : clicked && !exist?
end
end
My code is the following:
window = RAutomation::Window.new :title => windowTitle window.text_field(:class =>"Edit").set(file_name) window.button(:value => "&Open").click
Notes: Rautomation gem version 0.9.2 I am testing this on a remote VMware machine.If I physically logged into this VM, I am able to success. If not logged into that machine, I am getting this error message.
Where's the "no implicit conversion from nil to integer" error message you mentioned?
As Levi mentioned, then you have to have machine logged in. If using remote desktop for accessing the machine then after you close the session, then the machine is actually locked and not logged in. You can achieve the effect of machine being logged in all the time by using VNC or some similar service and turning off all sleep and screensaver functionality.
If you connect via VNC instead of remote desktop, then the machine won't be locked after disconnection.
Error message "no implicit conversion from nil to integer" has gone after i have update the Rautomation from 0.7.2 to 0.9.2.
But in my case I have not disconnect the VM machine logically, after i connected to that VM machine through remote desktop from my local machine, I am just minimize the remote desktop connection in my local machine and doing other stuffs on my machine. After i go back to that VM machine(click the minimized remote desktop) it is failing.
Thanks
And how is the script started? I'm not sure how you could run scripts within regular user environment with Jenkins, but if it does run them in some different context then this might cause the problems too.
Actually I am facing same problem(Rautomation timeout error) on two different setups.
So I think solution is same for the above two setups. If we could find the solution for one setup the other one get resolved automatically.
Thanks in advance.
Are you also getting that error when not minimizing RDP?
How is Jenkins starting the scripts? In what environment will they run? In which user rights?
No I am not getting any error when not minimizing. Everything works fine.
From Jenkins, it will connect to that same VM machine with super admin on the same Win7 environment and start the script by windows batch command.
Batch Command Example: ruby
In that case when you minimize, then something changes. Try with the VNC setup. Not sure how you could use that with Jenkins though. I guess you just have to experiment and google. You can also search about using AutoIt and using Jenkins, since it will probably have same problems as RAutomation, but since it is more popular, then you might find something from the Google.
Since this is not a problem with RAutomation per se, but it is rather the way Windows works when using remotely, then i'm closing this issue for now.
Sorry that we couldn't help you out with this problem.
@sarosini @jarmo when you minimize an RDC session, the interactive desktop session closes after awhile and tests start failing (as you've noted). If you don't want to use the VNC solution, you can still use RDP but you will need to create a shortcut to tscon.exe
onto your desktop that has the following parameters:
%windir%\System32\tscon.exe RDP-Tcp#0 /dest:console
When you double-click on that, if you have UAC turned on you'll be asked if you want to elevate your privileges. But after that runs, you will be kicked out of your RDC session immediately and the desktop will still be going.
@leviwilson I have tried RDP by using tscon.exe, but I am getting the following error message:
"Could not connect sessionID 1 to sessionname console, Error code 5 Error [5]:Access is denied."
Command I have used: windows/System32/tscon.exe RDP-Tcp#0 /dest:console from tscon.exe located folder.
P.S After I double click the shortcut exe, nothing happened just command prompt came in and gone.
Please advise
All,
Finally I found the solution to run GUI automation when RDC is minimized. Here are the steps to follow on the local computer(from which you have connected to remote machine)
HKEY_CURRENT_USERSoftwareMicrosoftTerminal Server Client (if you want to change the RDC settings for your user account)
– or —
HKEY_LOCAL_MACHINESoftwareMicrosoftTerminal Server Client (if you want to change the RDC settings for all accounts)
That’s all. Now minimizing the RDC window on your computer will not affect the remote computer’s GUI and the GUI will still be available to your automated GUI tests.
The access denied error is because you have to run that shortcut as an admin. You can specify that in the shortcut properties. On Jul 22, 2013 5:51 AM, "sarosini" notifications@github.com wrote:
All,
Finally I found the solution to run GUI automation when RDC is minimized. Here are the steps to follow on the local computer(from which you have connected to remote machine)
1.
Close Remote Desktop sessions opened on your computer. 2.
Click Start and select Run. In the Run dialog box, type regedit and press Enter. The Registry Editor starts. 3.
Locate any of the following Registry keys:
HKEY_CURRENT_USERSoftwareMicrosoftTerminal Server Client (if you want to change the RDC settings for your user account)
– or —
HKEY_LOCAL_MACHINESoftwareMicrosoftTerminal Server Client (if you want to change the RDC settings for all accounts)
- Create a new DWORD value in this key named RemoteDesktop_SuppressWhenMinimized. Specify 2 as the value data.
That’s all. Now minimizing the RDC window on your computer will not affect the remote computer’s GUI and the GUI will still be available to your automated GUI tests.
— Reply to this email directly or view it on GitHubhttps://github.com/jarmo/RAutomation/issues/69#issuecomment-21334364 .
Hi,
I have tried to kick off my test script from Jenkins for continuous integration. while doing file upload my script got failed because, that windows dialog box for upload file is not active when it is triggered from command line interface.
Could anybody help me on this issue?
Note: Whereas if I physically in the machine, then upload file get success. My problem is only on CLI interface call.