- Регистрация
- 02.05.2017
- Сообщения
- 263
- Благодарностей
- 191
- Баллы
- 43
Hi guys!
I hope someone can help me.
I'm experimenting with using variables in C# code (thanks to those kind users here who helped me use variables in the code!).
I want to have random settings to emulate moving a mouse/scrolling randomly over different parts of a page to look natural.
So I'm trying to make a C# code with several variables.
1. a variable find element attribute.
2. a variable match #
For example, here's the code (which works) without variables:
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0").FindElementByAttribute("img", "class", "lazy-image\\ loaded", "regexp", 0);
if (he.IsVoid) return -1;
code with variable (doesn't work):
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0").FindElementByAttribute(int.Parse(project.Variables["ToMouseTo"].Value));
if (he.IsVoid) return -1;
code with variable (attempt 2 - also doesn't work):
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0").FindElementByAttribute(int.Parse(project.Variables["ToMouseTo"].Value),int.Parse(project.Variables["RNDmatch"].Value));
if (he.IsVoid) return -1;
this code works with 1 variable:
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0").FindElementByAttribute("img", "class", "lazy-image\\ loaded", "regexp", int.Parse(project.Variables["RNDmatch"].Value));
if (he.IsVoid) return -1;
The problem I'm having:
C# code works when I just add a variable for the match # but not when I add a variable for the find element attribute.
I even tried to put the two variables together into one and then use that in the code but it keeps failing.
I don't know C# so I'm probably doing something wrong here. It's driving me nuts.
I keep getting this error message:
"Compile code of Error in action "CS1501" "No overload for method 'FindElementByAttribute' takes 1 arguments". [Row: 2; Column: 18]"
What does that mean?
Any help is much appreciated!! Thanks!
I hope someone can help me.
I'm experimenting with using variables in C# code (thanks to those kind users here who helped me use variables in the code!).
I want to have random settings to emulate moving a mouse/scrolling randomly over different parts of a page to look natural.
So I'm trying to make a C# code with several variables.
1. a variable find element attribute.
2. a variable match #
For example, here's the code (which works) without variables:
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0").FindElementByAttribute("img", "class", "lazy-image\\ loaded", "regexp", 0);
if (he.IsVoid) return -1;
code with variable (doesn't work):
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0").FindElementByAttribute(int.Parse(project.Variables["ToMouseTo"].Value));
if (he.IsVoid) return -1;
code with variable (attempt 2 - also doesn't work):
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0").FindElementByAttribute(int.Parse(project.Variables["ToMouseTo"].Value),int.Parse(project.Variables["RNDmatch"].Value));
if (he.IsVoid) return -1;
this code works with 1 variable:
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0").FindElementByAttribute("img", "class", "lazy-image\\ loaded", "regexp", int.Parse(project.Variables["RNDmatch"].Value));
if (he.IsVoid) return -1;
The problem I'm having:
C# code works when I just add a variable for the match # but not when I add a variable for the find element attribute.
I even tried to put the two variables together into one and then use that in the code but it keeps failing.
I don't know C# so I'm probably doing something wrong here. It's driving me nuts.
I keep getting this error message:
"Compile code of Error in action "CS1501" "No overload for method 'FindElementByAttribute' takes 1 arguments". [Row: 2; Column: 18]"
What does that mean?
Any help is much appreciated!! Thanks!