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.
我想获得一个标签值并将其传递给一个变量。假设我有:
<td class="label"> <label for="id5">**Text value**</label>
如何将字符串“文本值”传递给变量?我试过了:
string a = ie.Label(Find.ByFor("id5")).ToString();
但它没有任何价值......
您应该使用 Text-property(获取元素的内部文本以及该元素中包含的所有元素的内部文本。):
string a = ie.Label(Find.ByFor("id5")).Text;