Open cmacdonnacha opened 3 years ago
If the tester is using Selenium WebDriver for test automation, then you can create a void method below and then call the method before navigating to the application URL.
I have a codeblock in java but you could understand the logic and relate to a language that works for you otherwise use this:
public void ClearBrowserCache()
{
webDriver.Manage().Cookies.DeleteAllCookies();
Thread.Sleep(7000); /
}
Two questions:
Why the 7-second Thread.sleep?
And how does the Thread.sleep work without a Try/catch?
On Thu, May 27, 2021 at 10:51 AM Samuel Arogbonlo @.***> wrote:
If the tester is using Selenium WebDriver for test automation, then you can create a void method below and then call the method before navigating to the application URL.
I have a codeblock in java but you could understand the logic and relate to a language that works for you otherwise use this:
public void ClearBrowserCache() { webDriver.Manage().Cookies.DeleteAllCookies(); Thread.Sleep(7000); / }
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium-ide/issues/1198#issuecomment-849745609, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMDP3YK6NOXM5JEL4KMPHKDTPZS7JANCNFSM4YCXY22Q .
But then you could do it manually if that is overwhelming. The manual pattern is shown:
Using the Selenium IDE chrome extension.
Huge update, v4 is currently on its 40th iteration in alpha testing 😄
https://github.com/SeleniumHQ/selenium-ide/releases/tag/latest
@toddtarsi oh very cool! :smile:
So this might be supported soon?
@laikas123 - On v4, it would be very easy to add a command for this, but it's not currently in line with my focus.
My current focus is on optimizing around and allowing for REPL like interactions with java framework code, then javascript, and so forth. Basically, I am pivoting this tool away from a shared-runtime experience (cypress-like) to an IDE that primarily drives test frameworks by REPL interactions. This is to remove all traces of test-framework from the tool. The idea here is that convenience interactions like that already exist in a myriad of test-framework tools (nightwatch, seleniumbase, cypress even) and the drivers themselves driver.manage().cookies().delete()
or something. I'd rather remove us from the process of adding commands and seeing and using that code, so that any org can use the IDE to generate code in their framework of choice and not mine.
@toddtarsi that totally makes sense and thanks for the clear and helpful answer. In our case we are using the selenium ide extension to create tests and then using the command line runner to execute said tests later using the .side file. What's awesome is the command line runner automatically clears cookies for each test (from the looks of it). We were hoping to be able to clear cookies for the QA folks when they run a test from the extension before exporting to a .side file that way they don't have to clear cookies each time a test is run.
With that being said this is a really amazing extension and kudos for the awesome functionality it already has.
I don't suppose there's any "hacky" way I could modify the source code of the extension to clear cookies before running each test in the extension?
@laikas123 - I don't intend to deprecate the runtime until I have a much better alternative. Honestly my plan is to transition y'all (and myself) from that to using a wrapper on nightwatch-js for playback. I really think the v4 ide will give you a better experience here as-is right now, although much polish is needed still. The reason we moved to v4 is that from electron, our local playback uses the same runtime as the side-runner, so I just have much less pain and environment difference in general.
@toddtarsi thank you for al the help :+1:
Is there a way to clear browser data via the Selenium IDE chrome extension? Cookies, cache etc. I'd like to run this before each test.