twalpole / apparition

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

Add Node#property_names, Node#properties, similar to #attributes #21

Closed TylerRick closed 5 years ago

TylerRick commented 5 years ago

Not sure if this would be helpful to others, but when I was trying to figure out a way to check validity (#20), I needed a way to see what properties apparition was actually seeing and found these methods useful...

The prop.match(/[a-z]/ was to exclude all these properties:

=> {"0"=>{"type"=>"object", "subtype"=>"node", "className"=>"Option", "description"=>"option", "objectId"=>"{\"injectedScriptId\":2,\"id\":369}"},
 "1"=>{"type"=>"object", "subtype"=>"node", "className"=>"HTMLOptionElement", "description"=>"option", "objectId"=>"{\"injectedScriptId\":2,\"id\":370}"},
 "2"=>{"type"=>"object", "subtype"=>"node", "className"=>"HTMLOptionElement", "description"=>"option", "objectId"=>"{\"injectedScriptId\":2,\"id\":371}"},
 "3"=>{"type"=>"object", "subtype"=>"node", "className"=>"HTMLOptionElement", "description"=>"option", "objectId"=>"{\"injectedScriptId\":2,\"id\":372}"},

(I'm sure there's a better way to do that, but what is it?)

twalpole commented 5 years ago

I get properties but what's the use case for `property_names' ?

twalpole commented 5 years ago

Closing due to lack of response