How to use delete_all_cookies method of Selenium.WebDriver.Remote Package

Best Selenium code snippet using Selenium.WebDriver.Remote.delete_all_cookies


Source:driver.rb Github


Full Screen

...206 def native_args(args)207 { |arg| arg.is_a?(Capybara::Selenium::Node) ? arg.native : arg }208 end209 def clear_browser_state210 delete_all_cookies211 clear_storage212 rescue Selenium::WebDriver::Error::UnhandledError # rubocop:disable Lint/HandleExceptions213 # delete_all_cookies fails when we've previously gone214 # to about:blank, so we rescue this error and do nothing215 # instead.216 end217 def delete_all_cookies218 @browser.manage.delete_all_cookies219 end220 def clear_storage221 clear_session_storage unless options[:clear_session_storage] == false222 clear_local_storage unless options[:clear_local_storage] == false223 rescue Selenium::WebDriver::Error::JavascriptError # rubocop:disable Lint/HandleExceptions224 # session/local storage may not be available if on non-http pages (e.g. about:blank)225 end226 def clear_session_storage227 if @browser.respond_to? :session_storage228 @browser.session_storage.clear229 else230 warn 'sessionStorage clear requested but is not supported by this driver' unless options[:clear_session_storage].nil?231 end232 end...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Selenium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?