xpath - Python lxml - get selected options -
i'm trying access selected options in select using lxml looks lxml doesn't know property. here code:
for option in productfield.xpath('select//option'): if 'selected' in option.attrib: print(option) when print(option.attrib) see {'value': 'value...'}. wrong somewhere?
got it.
if (productfield.xpath('select//option[@selected="selected"]')): option in productfield.xpath('select//option[@selected="selected"]'): print(option)
Comments
Post a Comment