问题
I want to fetch the value of aria-expanded from below xpath //div[@id='contact-information']//div[@aria-expanded='false']
Which keyword should I use ?
回答1:
Selenium2Library.Get Element Attribute should do the trick.
http://robotframework.org/Selenium2Library/doc/Selenium2Library.html#Get%20Element%20Attribute
example: Get Element Attribute //div[@id='contact-information']//div[@aria-expanded='false']@aria-expanded
回答2:
You can use the keyword Get Value that returns the value attribute of element identified by locator.
来源:https://stackoverflow.com/questions/38195935/want-to-fetch-value-of-an-attribute-in-robot-framework