I encounter a issue in jenkins job, i want to the jenkins could start IE browser by job automatically to access a website.The slave is a Win7 system and this IE browser's plugin only allow one instance. So my job is like below:
@echo off
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
set isIE=0
for /f %%i in ('tasklist') do (
rem echo %%i
if %%i == iexplore.exe (
set isIE=1
)
)
if %isIE% == 1 (
echo "Find IE process, kill them"
taskkill /F /IM "iexplore.exe"
) else (
echo "No IE process"
)
echo %date% %time%
start iexplore.exe "http://www.example.com"
sleep 5
tasklist | findstr iexplore.exe
echo %date% %time%
You can see, after i start the IE browser, the job will wait 5 seconds and then check the IE process by command:[tasklist | findstr iexplore.exe]. it'll print the IE process information for troubleshooting.
But, if i add this command in the job. The job will close the IE browser after the job executed. I don't know why? If i remove this snippet, the job will start the IE and never close it.. I have no idea at it, Who can help me to find the root cause? Thanks..