简体   繁体   中英

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 occurring 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.

尝试使用Browser.DeleteCookies和/或Browser.ClearCache

It sounds like your application is saving your login details. If its saved in the browser, you could try this (probably will need some code to do this). Once cleared, you should be able to launch your browser to the login page

ClearMyTracksByProcess has a patchy support for various IE versions. Did you check whether the cookies were indeed deleted?

For IE, you have various option:

WebUtil.DeleteCookies

or as Motti pointed out

Browser("Google.com").DeleteCookies "Google"
Browser("Google.com").ClearCache

You may also want to have a look at this article There are number of methods discussed on the article as well as in the comments section.

For apps having different roles may be logging out before entering another session is good idea as Trimble Epic pointed out. If you have a separate logging page then may be close that logging page you used to go to your web app portal so that session is completed or cleared. Usually, if same id's are used to log into web app and same time if your id is used in other application of your organization that might also cause the issue. I always used to forget to put log-out function on the end and used to get same issue time to time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM