我如何使用C#验证按钮上的文本在selenium中是否正确
本文关键字:selenium 是否 文本 何使用 验证 按钮 | 更新日期: 2023-09-27 18:00:50
我需要验证按钮上的文本是否正确?如何使用C#获取硒元素中按钮上的文本。感谢
嗨,谢谢你的回答,实际上我现在用这个方法得到了。
public static T GetAttributeAsType<T>(this IWebElement element, string attributeName)
{
string value = element.GetAttribute(attributeName) ?? string.Empty;
return (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFromString(value);
}