twalpole / apparition

Capybara driver for Chrome using CDP
MIT License
363 stars 46 forks source link

Fixes bug: TypeError: exception class/object expected #30

Closed zealot128 closed 5 years ago

zealot128 commented 5 years ago

Recently, I've received an error on all interactions with capybara (e.g. fill_in(foo), click_on(bla)),

I've only received the output: "TypeError: exception class/object expected"

After digging into the process_response, I've got this error from the server:

{"result"=>
  {"type"=>"object",
   "subtype"=>"error",
   "className"=>"TypeError",
   "description"=>"TypeError: Assignment to constant variable.\n    at HTMLInputElement.<anonymous> (<anonymous>:4:6)\n    at HTMLInputElement.<anonymous> (<anonymous>:29:4)",
   "objectId"=>"{\"injectedScriptId\":2,\"id\":8}"},
 "exceptionDetails"=>
  {"exceptionId"=>1,
   "text"=>"Uncaught",
   "lineNumber"=>3,
   "columnNumber"=>5,
   "scriptId"=>"23",
   "stackTrace"=>{"callFrames"=>[{"functionName"=>"", "scriptId"=>"23", "url"=>"", "lineNumber"=>3, "columnNumber"=>5}, {"functionName"=>"", "scriptId"=>"23", "url"=>"", "lineNumber"=>28, "columnNumber"=>3}]},
   "exception"=>
    {"type"=>"object",
     "subtype"=>"error",
     "className"=>"TypeError",
     "description"=>"TypeError: Assignment to constant variable.\n    at HTMLInputElement.<anonymous> (<anonymous>:4:6)\n    at HTMLInputElement.<anonymous> (<anonymous>:29:4)",
     "objectId"=>"{\"injectedScriptId\":2,\"id\":9}"}}}

Saw the raw "el = this" without let/const modifier and added let. That seemed to fix the problem.

Chrome Version:

twalpole commented 5 years ago

Thanks for this.