Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Can anybody help me about how to use these two functions to get value of any CSS property.
<img>如果有如下特定标签
<img>
<img title="Title" alt="myTitle" src="A/B/C/xyz.png">
driver.getElement(By.tagName("img")).getAttribute("src")将为您src提供此标签的属性。结果 -A/B/C/xyz.png
driver.getElement(By.tagName("img")).getAttribute("src")
src
A/B/C/xyz.png
同样,您可以获取诸如 等属性的title值alt。
title
alt
同样,您可以通过使用获取任何标签的 CSS 属性getCssValue("some propety")
getCssValue("some propety")