Click one of a link in a page (randomly)

myboty

Новичок
Регистрация
22.05.2019
Сообщения
28
Благодарностей
1
Баллы
3
Hello,

I'm creating my first script with Zennoposter. I would like to simulate a visitor's surfing. Any link on the page should be randomly clicked.
I don't know how to do that.

Thank you for your help.
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Hi.
1. Find all links on the page
2. Save links in List
3. Take a random line from a list
4. Use the link in Click action to click random link
 

myboty

Новичок
Регистрация
22.05.2019
Сообщения
28
Благодарностей
1
Баллы
3
I have to do the same thing for ten pages, I don't see myself doing it for 100 links. There must be a smart method with Zennoposter.
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
I have to do the same thing for ten pages, I don't see myself doing it for 100 links. There must be a smart method with Zennoposter.
LOL I posted logic steps you have to take to achieve what you want.
You have to make that logic once to use on any pages.
Of course there are many other ways how to do that, but I have posted one.
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
There are another way much shorter.
42726


If In previous logic you would be able to check if this link is an internal link or external link, then this logic will click any random link, even if this will be external link what will lead you to another page.
 

myboty

Новичок
Регистрация
22.05.2019
Сообщения
28
Благодарностей
1
Баллы
3
Thank you a lot @lokiys, I will try this way.
 

myboty

Новичок
Регистрация
22.05.2019
Сообщения
28
Благодарностей
1
Баллы
3
I search the regex to obtaint somethings like that:

grep -Po '(?<=href=")/[^#"]*(?=")' index.html

and adapt it to Zennoposter. If you have and idea.

I want to keep only internal URL. They are somethings like that :
/myurl
/my/url

I should exclude URL having a anchor in the beging /# or having http ou https
 

myboty

Новичок
Регистрация
22.05.2019
Сообщения
28
Благодарностей
1
Баллы
3
I have try:
^/[^#]*$
In accordance with the documentation, but it doesn’t work.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 453
Благодарностей
5 913
Баллы
113
If you want to create regex, you should investigate source code of a webpage and use regex tester to create proper regular expressions to parse links.
 

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