C# - "last" keyword not working in FindElementByAttribute

Hypno

Новичок
Регистрация
12.10.2018
Сообщения
3
Благодарностей
1
Баллы
3
I want to click on the last element using C#. I've converted click block to C# and got:

// Action designer, type RiseEvent
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0").FindElementByAttribute("span", "class", "value", "text", last);
if (he.IsVoid) return -1;

// Emulation delay
instance.WaitFieldEmulationDelay();
// Call the event "click"
he.RiseEvent("click", instance.EmulationLevel);

I got error with the "last" keyword.

How can I click on the last element using C#?
 
  • Спасибо
Реакции: orka13

Hypno

Новичок
Регистрация
12.10.2018
Сообщения
3
Благодарностей
1
Баллы
3
Really, no one?
So, maybe it's a bug?
 

woober

Client
Регистрация
07.04.2015
Сообщения
211
Благодарностей
123
Баллы
43
var heCollection = instance.ActiveTab.GetDocumentByAddress("0").FindElementsByAttribute("span", "class", "value", "text");
HtmlElement he = heCollection.Last; // or heCollection.ElementAt(heCollection.Count-1); // or heCollection.ElementAt(heCollection.Length-1);
if (he.IsVoid) return -1;

// Emulation delay
instance.WaitFieldEmulationDelay();
// Call the event "click"
he.RiseEvent("click", instance.EmulationLevel);
 
  • Спасибо
Реакции: orka13, VladZen и Hypno

Hypno

Новичок
Регистрация
12.10.2018
Сообщения
3
Благодарностей
1
Баллы
3
Thanks.
So IMO Zennoposter crew should change "Convert to C#" if the 5th keyword is "last" to one of Your solutions.
 

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