如何从selenium中的href链接获取属性值
我试图从“a href”属性获取链接
Download
我在做什么:
ReadOnlyCollection lists1 = driver.FindElements(By.ClassName("dl_link")); string s = lists1[0].GetAttribute("a href");
我正在获取类“dl_link 1”的元素,但我无法得到它的链接,字符串为空?
您需要使用实际属性名称调用GetAttribute()
。 更换:
lists1[0].GetAttribute("a href");
有:
lists1[0].GetAttribute("href");
C#
element.GetAttribute("attribute name");
ruby
element.attribute("attribute name")
python
element.get_attribute("attribute name")
Java的
上述就是C#学习教程:如何从selenium中的href链接获取属性值分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
element.getAttribute("attribute name")
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/943143.html