splinter icon indicating copy to clipboard operation
splinter copied to clipboard

ElementAPI compatible with item getters

Open medecau opened this issue 6 years ago • 9 comments

Please, provide access to HTML attributes through item getters.

The following code makes three assertions of which only one works.

import operator
import splinter

b = splinter.Browser()
b.visit('https://www.google.com/')
q = b.find_by_name('q').first

assert 'q' == q.get('name')
assert 'q' == operator.itemgetter('name')(q)
assert 'q' == q['name']

I would write the change myself but I have been unable to properly run the test-suite.

medecau avatar May 23 '20 21:05 medecau

Hi, Is this issue still up for fix? I'd like to.

rg666 avatar Feb 10 '21 20:02 rg666

@rg666 Go for it.

javascript-error avatar Feb 11 '21 01:02 javascript-error

Can you please assign to me. @jsfehler

rg666 avatar Feb 12 '21 13:02 rg666

PR 856 provided, would you please review it? Thank you! @jsfehler

rg666 avatar Feb 12 '21 17:02 rg666

@rg666 @medecau Item getters appear to already work. I'll gladly accept unit tests for those behaviours since it appears they go untested at the moment.

I don't see any compelling reason to add .get as a method to ElementAPI

javascript-error avatar Feb 12 '21 19:02 javascript-error

Thank you for the review comments, it was my first PR. Ah, I was working on the review comments. If .get() method isn't required, please let me know. :) @jsfehler @medecau

rg666 avatar Feb 12 '21 19:02 rg666

@rg666 I don't see any bugs involving item getters or missing functionality. I encourage you to write unit tests for the behaviour so we can verify they work. If the unit tests pass, I'll close this issue.

javascript-error avatar Feb 12 '21 19:02 javascript-error

Noted.

rg666 avatar Feb 12 '21 19:02 rg666

I don't see any compelling reason to add .get as a method to ElementAPI

Okay.

medecau avatar Feb 13 '21 17:02 medecau