UFT opening browser with old session for IE Browser
I am automating a website where a user can login with different roles.But, after performing a operation with a specific roles when i am again opening the browser for another roles then UFT is opening browser with old session.
Note: This issue is occuring if i am running all the test cases in a suite. If i am running the scripts individually then it's working fine.
Moreover, I am also using a function to delete all the cookies and clear caches before opening the browser by using the command "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255"
Please help on this.
Couple of things you can try -
1. Use systemutil.closeprocessbyname "iexplore.exe" to close
2. In IE browser settings select the option 'delete browsing history on exit'
See if it helps.
Accept as solution/Give Kudos to the author if the piece of information answered/helped you to solve your problem.
All the thoughts here are mine not related to my employer nor anyone.
Thanks for yor reply, I 'll try these options as mentioned by you. But, currently i am closing the browser using command "Browser("Browser").Close"
Will try and let you know the result.....
I tired both options but no luck...
If i am using systemutil.closeprocessbyname "iexplore.exe" then it's closing all the browser and ALM too but i dont want to close the ALM. For this i am using separate function to close all the browser except ALM.
for second one i tried but still same issue is occurring. Let me exaplain in details what is happening.
Suppose i have 15 test cases for one role and then 15 for others and so on. I have putted then in a sequence that all the 15 for one role will be executed first then i am chaning the role using role change function and then next 15 scripts are started and working fine. But, after some scripts say 7-8 scripts for second role are executed then UFT is opening the browser with first role while it should open browser with latest role. I have tried to run teh suite for several time and everytime it's opening the old session browser for same script.
Please suggest something...
Can anyone has idea why it's happening, what causing UFT to open browser with old session only if i am running scripts in a suite via ALM whereas all the scripts are working fine individually.
If i am using systemutil.closeprocessbyname "iexplore.exe" then it's closing all the browser and ALM too but i dont want to close the ALM.
Guess there may be 2 possible causes for the current behaviour.
1). You are not closing the browser completely but closing just one of them. I think IE retains the cookies & restores them back.
Read the section Session Cookies here for more info.
2). You are trying to clearing the Cookies with the below command, which only clears the cookies in 'Un Protected' IE.
"RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255"
Guess you are by default running in Protected Mode & hence the command won't delete all the cookies.
You can try the different options to run the command with more premissions as described here.
Alternately you can close all the browsers including ALM and check if that clears the Session Cookies. Why do you need ALM up, when you are running your tests? Can't you run it on another host machine if you want to trigger it yourself?