How to change string to int?

mason

Client
Регистрация
30.04.2017
Сообщения
46
Благодарностей
3
Баллы
8
I have a link i need to click. It changes locations everytime you load the page.

I take the DOM have worked it out to this.....

playlist_count is a number. How to I change this number "16" to c# or an int that will work with the standard cubes?

Код:
int number = project.Variables["playlist_count"].Value;

// Action designer, type RiseEvent
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0;_0;0").FindElementByAttribute("div", "class", "disableText", "regexp", number);
if (he.IsVoid) return -1;

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

i
 

mason

Client
Регистрация
30.04.2017
Сообщения
46
Благодарностей
3
Баллы
8
Код:
string s1 = project.Variables["playlist_count"].Value;
int num1 = 0;

num1=Convert.ToInt32(s1);
// Action designer, type RiseEvent
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0;_0;0").FindElementByAttribute("div", "class", "disableText", "regexp", num1);
if (he.IsVoid) return -1;

// Emulation delay
instance.WaitFieldEmulationDelay();
// Call the event "click"
he.RiseEvent("click", instance.EmulationLevel);
This seems to work ok. Is there a better way?
 

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
524
Благодарностей
112
Баллы
43
Yes, the better and the only way.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 251
Благодарностей
5 849
Баллы
113
int a = int.Parse(project.Variables["var1"].Value);
 
  • Спасибо
Реакции: mason

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