Click to Random Link on a website

polcreate

Новичок
Регистрация
14.04.2018
Сообщения
18
Благодарностей
0
Баллы
1
Hi guys,
I am trying to write a script in #C to click a random link on a website.

Steps:
1. find a link using FindElementByAttribiute("a","href","domain.com","regexp",0)
2. Move mouse using FullEmulationMouseMoveToHtmlElement
3. Click to the link using MouseClick

The only problem with step 1 is, that the script always finds the first element (0), but I need random.

Any suggestions?
P.S. I am not good with #C ;-)
 

polcreate

Новичок
Регистрация
14.04.2018
Сообщения
18
Благодарностей
0
Баллы
1
P.S. Internal links only
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 768
Благодарностей
1 179
Баллы
113
Hi.

First find how much elements on page are with "FindElementsByAttribiute().Count"
Then generate random number from range 0-Elementscount
Add random number in first step where 0 are.

Good luck.
 
  • Спасибо
Реакции: orka13

polcreate

Новичок
Регистрация
14.04.2018
Сообщения
18
Благодарностей
0
Баллы
1
works - thx
 

polcreate

Новичок
Регистрация
14.04.2018
Сообщения
18
Благодарностей
0
Баллы
1
Another problem - I hope the last one ;-)
Using FindElementsByAttribiute() I am trying to find all links on the website, but without #, jpeg, gif etc, so basically (.html,.htm,.php,/,and without / at the end)
I was trying many different patterns but doesn't work good in #C (everything is fine in Regular expression Designer)

I was trying this to exclude few extensions
((?!#|.png|.jpe?g).)*?

And this, to keep only html,php and / at the end
((?!#).)*?(\.html?|\.php|\/)


As I said, everything works fine in Regular expression Designer and testers like https://regexr.com/ but not in Zenno #C

Please help...
 

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