【发布时间】:2015-12-07 07:27:01
【问题描述】:
基于Selenium webdriver: How do I find ALL of an element's attributes?中提出的问题
当我使用这个答案时,我得到了元素属性的预期结果。但是它不是最新的,换句话说不是我在屏幕上看到的。
例如:
>attrs = driver.execute_script('var items = {}; for (index = 0; index <arguments[0].attributes.length; ++index) { items[arguments[0].attributes[index].name] = arguments[0].attributes[index].value }; return items;', vlan)
>print attrs
{ u'name': u'PixF1InterfaceVLAN', u'value': u'1',}
但是,如果我查看相同的元素“vlan”:
>vlan.get_attribute("value")
u'10'
这是我在屏幕上看到的。我的问题是如何更新 Javascript 代码以显示正确的属性列表?
【问题讨论】:
标签: javascript python selenium attributes webdriver