Getting the attribute using -1 for document Number in c#

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

zenfreak

Client
Регистрация
21.08.2013
Сообщения
249
Реакции
12
Баллы
18
1.This ProjectMaker action:
K47G9Ac.jpg

should be translated to this:

Код:
Развернуть Свернуть Копировать
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("-1").FindElementByAttribute("div", "class", "awesomeClass", "text", 0);
string leftPlusButt = he.GetAttribute("height");

BUT while using -1 for the Document# in the ProjectMaker action will correctly get the attribute, when using the same value in the C# code it will not get any value at all.

if I'm using:

Код:
Развернуть Свернуть Копировать
[CODE]HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("div", "class", "awesomeClass", "text", 0);
string leftPlusButt = he.GetAttribute("height");

I will get the expected value but this means I cannot use -1 when I'm unsure of the exact document #. Can someone tell me why this behavior?

2. Where is the Form# in the C# code?
VK93eGH.jpg
 
Form can be specified using FindElementByTag method, here is the example:
Код:
Развернуть Свернуть Копировать
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByTag("form", 1).FindChildById("text");
But if you want to search elements in all documents (-1) and all forms (-1) on webpage, just use FindElementByAttribute method without GetDocumentByAddress and FindElementByTag.
 
  • Спасибо
Реакции: zenfreak
Now it makes sense, thank you!

For those who didn't understand, my initial code should be:

Код:
Развернуть Свернуть Копировать
HtmlElement he = instance.GetTabByAddress("page").FindElementByAttribute("div", "class", "awesomeClass", "text", 0);
string leftPlusButt = he.GetAttribute("height");
 

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