IE running background when running automation scripts

Ask general questions here.
kalikisiva
Posts: 1
Joined: Thu Mar 13, 2014 4:18 pm

IE running background when running automation scripts

Post by kalikisiva » Thu Mar 13, 2014 4:22 pm

I am trying to execute Ranorex automation(Ranorex 4.0.2) test scripts using anthipro CI on Windows Server 2008,
• but once I trigger running tests ,I see that Internet Explorer not showing up and all tests getting failed.
• Then I opened IE(Internet Explorer 9) on windows server 2008, then I see “Your last browsing session closed unexpectedly(Restore session)”, when I click “Restore session” I am seeing many IE BROWERS(as many as my tests). So by this I can say Internet Explorer running back ground and IE is not popping up to run UI tests.
• I am executing tests using “E:\_tmp\dev\.tmp\Ranorex\Socrates.exe /zr /zrf:E:\Eureka\Ranorex\Reports\Reports-Build-0.rxzlog )”

Logs:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
command line: E:\anthill\agent\var\temp\shell_command_1394654786728_3cadec52.bat
script body:
set ENV=dev set ARTIFACTS_FOLDER=E:\_tmp\%ENV%\.tmp\Ranorex set REPORTS_FOLDER=E:\Eureka\Ranorex\Reports REM set /p BUILD_ID=<%ARTIFACTS_FOLDER%\build.info set BUILD_ID=0 set REPORT_NAME=%REPORTS_FOLDER%\Reports-Build-%BUILD_ID%.rxzlog %ARTIFACTS_FOLDER%\Socrates.exe /zr /zrf:%REPORT_NAME% @endlocal
working directory: E:\_tmp\dev
command environment:
AH_AUTH_TOKEN=*****
AH_BUILD_LIFE_ID=16429
AH_JOB_ID=3639414
AH_PROFILE_ID=262
AH_PROJECT_ID=252
AH_REMOTE_HOST=anthillpro.gsk.com
AH_REMOTE_PORT=4567
AH_REQUEST_ID=1946081
AH_WEB_URL=https://anthillpro.gsk.com
AH_WORKFLOW_ID=613
connection_strings_aesopread_password=*****
connection_strings_cis_password=*****
connection_strings_eureka_password=*****
connection_strings_eurekaapp_password=*****
connection_strings_eurekagsksearch_password=*****
connection_strings_eurekaprd_password=*****
connection_strings_kateread_password=*****
connection_strings_mcsi_password=*****
connection_strings_targetpedia_eurekaapp_password=*****
eureka_deploy_tmp=E:\_tmp
eureka_dist_home=E:\Eureka\Distributions
eureka_dist_type=debug
passwords_citeline_password=*****
passwords_gskidol_password=*****
passwords_gskusersed_password=*****
passwords_ldap_password=*****
passwords_proxy_password=*****
passwords_reaxys_password=*****
passwords_stsfunctionaluser_password=*****
===============================
command output:

E:\_tmp\dev>set ENV=dev

E:\_tmp\dev>set ARTIFACTS_FOLDER=E:\_tmp\dev\.tmp\Ranorex

E:\_tmp\dev>set REPORTS_FOLDER=E:\Eureka\Ranorex\Reports

E:\_tmp\dev>REM set /p BUILD_ID=<E:\_tmp\dev\.tmp\Ranorex\build.info

E:\_tmp\dev>set BUILD_ID=0

E:\_tmp\dev>set REPORT_NAME=E:\Eureka\Ranorex\Reports\Reports-Build-0.rxzlog

E:\_tmp\dev>E:\_tmp\dev\.tmp\Ranorex\Socrates.exe /zr /zrf:E:\Eureka\Ranorex\Reports\Reports-Build-0.rxzlog
[2014/03/12 16:06:29.801][Debug ][Logger]: Console logger starting.
[2014/03/12 16:06:29.988][Info ][Test]: Test Suite 'Socrates' started.
[2014/03/12 16:06:30.019][Info ][Test]: Test Case 'Checker' started.
[2014/03/12 16:06:30.019][Info ][Test]: Test Case Iteration #1' started.
[2014/03/12 16:06:30.051][Info ][Test]: Test Module 'SS_MetaData' started.
[2014/03/12 16:06:30.113][Info ][Data]: Current variable values:
$strEnvironment = 'dev', $strBrowser = 'IE', $strApplication = 'SS'

Please help

Thanks,
Siva

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: IE running background when running automation scripts

Post by Support Team » Mon Mar 17, 2014 1:46 pm

Hi kalikisiva,

Please make sure that no firewall or antivirus software is blocking your test solution.
Ensure that the test run is executed with administrator privileges.
Finally, please make sure that Anthipro CI is not started as a service since a service does not have sufficient rights to start UI-applications.

Regards,
Robert
.
Image

mdgairaud
Posts: 87
Joined: Sun Aug 05, 2012 11:59 am
Location: Bilbao, Spain

Re: IE running background when running automation scripts

Post by mdgairaud » Thu Mar 20, 2014 11:25 am

If IE is opened but in second plane or minimized just put in of frontplane or maximize.


Here's a snippet to maximize any windows by window name or handle.

Code: Select all

private const int SW_SHOWNORMAL = 1;
        private const int SW_SHOWMINIMIZED = 2;
        private const int SW_SHOWMAXIMIZED = 3;

        [DllImport("user32.dll")]
        private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
        public void MaximizarVentana(IntPtr hWnd)
        {
            if (!hWnd.Equals(IntPtr.Zero))
            {
                ShowWindowAsync(hWnd, SW_SHOWMAXIMIZED);
            }
        }

        public void MaximizarVentana(string titulo)
        {
            IntPtr intptr = FindWindow(null, titulo);
            if (!intptr.Equals(IntPtr.Zero))
            {
                ShowWindowAsync(intptr, SW_SHOWMAXIMIZED);
            }
        }

And another snippet to bring a window to front by window name:

Code: Select all

[DllImport("USER32.DLL")]
        public static extern bool SetForegroundWindow(IntPtr hWnd);
        public void TraerVentanaAlFrente(string nombreVentana)
        {
            IntPtr handle = FindWindow(null, nombreVentana);

            // Verify that Calculator is a running process.
            if (handle == IntPtr.Zero)
            {
                return;
            }

            // Make Calculator the foreground application
            SetForegroundWindow(handle);

            Ranorex.Delay.Duration(2000);
        }

when the message of "“Your last browsing session closed unexpectedly(Restore session)”" don't press restore because it opens a lot of windows and can hang your computer. Start a new session, open a new tab with google and close it by pressing the X. Open IE again to ensure the session was closed safely. It happens to me sometimes and when I restore the session, dozens of IE windows opens hanging my computer :evil:


regards,
Mateo.