How can I get the href attribute from the "a" tag?

  • Автор темы Автор темы zenfreak
  • Дата начала Дата начала

zenfreak

Client
Регистрация
21.08.2013
Сообщения
249
Реакции
12
Баллы
18
Why I can't get the href attribute for the a tag like the code below?

Код:
Развернуть Свернуть Копировать
HtmlElementCollection heCol = doc.FindElementsByAttribute("div", "class", "myAwesoneClass", "text")
string postAuthor = heCol.GetByNumber(5).FindChildByAttribute("a", "class", "anotherClass", "text", 0).href;

What would be a better approach?
 
I found the answer. I should use the GetAttribute method
Код:
Развернуть Свернуть Копировать
string postAuthor = heCol.GetByNumber(5).FindChildByAttribute("a", "class", "anotherClass", "text", 0).GetAttribute("href");
 
  • Спасибо
Реакции: LightWood

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)