browser.cookies.clear does not work on Edge browser

Issue #14838528 • Assigned to Steven K.

Details

Author
Mark D.
Created
Nov 27, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
15.15063
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Issue
browser.cookies.clear does not work.
On FF/Chrome I can use this and it will delete all cookies.
On Edge I get this error

irb(main):001:0> require 'watir'
=> true
irb(main):002:0> browser = Watir::Browser.new :edge
=> #<Watir::Browser:0x..fa0b676a0 url="about:blank" title="">
irb(main):003:0> browser.cookies.clear
Selenium::WebDriver::Error::UnknownError: Unknown error
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/remote/response.rb:69:in `assert_ok'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/remote/response.rb:32:in `initialize'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/remote/http/common.rb:81:in `new'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/remote/http/common.rb:81:in `create_response'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/remote/http/default.rb:104:in `request'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/remote/bridge.rb:168:in `execute'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/remote/w3c/bridge.rb:535:in `execute'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/remote/w3c/bridge.rb:326:in `delete_all_cookies'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/w3c_options.rb:38:in `delete_all_cookies'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.9.1/lib/watir/cookies.rb:92:in `clear'
        from (irb):3
        from C:/Ruby23/bin/irb.cmd:19:in `<main>'
irb(main):004:0>

When I first navigate to the website and then perform the clear command, I’m not getting any error, but the cookies are still in place. (see attached screenshot)

Attachments

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Steven K.”

  • Watir docs for reference: http://www.rubydoc.info/gems/watir-webdriver/Watir/Cookies

    Besides .clear I also tried .delete ‘name’ both did not delete the cookie.
    Here is another example of a website that is not accessible for the outside, but it demonstrates the issue:

    irb(main):014:0> browser :edge
    No default device, nor a selected device was set. Browser default settings will be loaded. More info: http://testautomation.info/Lapis_Lazuli:Device_Simulation
    2017-11-28 09:55:17 INFO Watir Creating Browser instance of edge with user provided options: {}
    2017-11-28 09:55:17 INFO Watir Creating Browser instance with Watir processed options: {:http_client=>#, :desired_capabilities=>#"MicrosoftEdge", :version=>"", :platform=>:windows, :javascript_enabled=>true, :css_selectors_enabled=>true, :takes_screenshot=>true, :native_events=>false, :rotatable=>false, :firefox_profile=>nil, :proxy=>nil}>}
    => #, @assertions=5>
    irb(main):015:0> Watir.logger.level = :info
    => :info
    irb(main):016:0> browser.goto "https://[INTERNAL_URL]"
    => "https://[INTERNAL_URL]"
    irb(main):017:0> browser.cookies.to_a
    NoMethodError: undefined method `map' for nil:NilClass
            from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/options.rb:91:in `all_cookies'
            from C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.9.1/lib/watir/cookies.rb:21:in `to_a'
            from (irb):17
            from C:/Ruby23/bin/irb.cmd:19:in `'
    irb(main):018:0> browser.find(:like => [:input, 'data-mp-l10n', 'Agree']).click
    2017-11-28 09:56:54 INFO Watir -> `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :index=>0}>#tag_name` after `#wait_for_exists`
    2017-11-28 09:56:54 INFO Watir <- `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :index=>0}>#tag_name` has been completed
    2017-11-28 09:56:54 INFO Watir -> `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :index=>0}>#attribute_value` after `#wait_for_exists`
    2017-11-28 09:56:54 INFO Watir <- `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :index=>0}>#attribute_value` has been completed
    2017-11-28 09:56:54 INFO Watir -> `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :index=>0}>#tag_name` after `#wait_for_exists`
    2017-11-28 09:56:54 INFO Watir <- `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :index=>0}>#tag_name` has been completed
    2017-11-28 09:56:54 INFO Watir -> `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :tag_name=>"input", :index=>0}>#visible?` after `#assert_exists`
    2017-11-28 09:56:54 INFO Watir <- `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :tag_name=>"input", :index=>0}>#visible?` has been completed
    2017-11-28 09:56:54 INFO Watir -> `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :tag_name=>"input", :index=>0}>#click` after `#wait_for_enabled`
    2017-11-28 09:56:54 INFO Watir -> `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :tag_name=>"input", :index=>0}>#enabled?` after `#assert_exists` (as a prerequisite for a previously specified execution)
    2017-11-28 09:56:54 INFO Watir <- `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :tag_name=>"input", :index=>0}>#enabled?` has been completed
    2017-11-28 09:56:55 INFO Watir <- `#"//input[contains(concat('', normalize-space(@data-mp-l10n), ''), 'Agree')]", :tag_name=>"input", :index=>0}>#click` has been completed
    => nil
    irb(main):019:0> browser.cookies.to_a
    => [{:name=>"acceptedCookies", :value=>"y", :path=>"/", :domain=>"{INTERNAL_URL}", :expires=>2018-11-28 09:56:55 +0100, :secure=>false}]
    irb(main):020:0> browser.cookies.clear
    => nil
    irb(main):021:0> browser.cookies.to_a
    => [{:name=>"acceptedCookies", :value=>"y", :path=>"/", :domain=>"[INTERNAL_URL]", :expires=>2018-11-28 09:56:55 +0100, :secure=>false}]
    irb(main):022:0> browser.cookie.delete 'acceptedCookies'
    NoMethodError: undefined method `cookie' for #
            from C:/Ruby23/lib/ruby/gems/2.3.0/gems/lapis_lazuli-2.0.1/lib/lapis_lazuli/browser.rb:204:in `method_missing'
            from (irb):22
            from C:/Ruby23/bin/irb.cmd:19:in `'
    irb(main):023:0> browser.cookies.delete 'acceptedCookies'
    => nil
    irb(main):024:0> browser.cookies.to_a
    => [{:name=>"acceptedCookies", :value=>"y", :path=>"/", :domain=>"[INTERNAL_URL]", :expires=>2018-11-28 09:56:55 +0100, :secure=>false}]
    irb(main):025:0>
    

You need to sign in to your Microsoft account to add a comment.

Sign in