Finding element inside another problem

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
Hello,

I am having a real issue for one of my own template. Here is an example:

44685



I have multiple DIVs inside a form like this and would like to detect if a user JOINED, if not, click on subscribe.

The problem I am having is that all the classes and ids in the form are dynamically generated...no real easy to find foot prints.

I tried to use xpath and it gives me something like this:
//*[@id="react-root"]/div[1]/div[1]/div[2]/main/div[1]/div[1]/div[1]/div[1]/div[1]/div[27]/section/div[1]/div[1]/div[1]/div[424]/div[1]/div[1]

The problem is that when I click on search element after Xpath gives me this solution, I get a warning saying element not found.

How would you troubleshoot this kind of issue please?

Thank you.
 

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
How would you(by words) crack a problem like this please? I just need to understand the logic of Zenno on this.

ie:

You have:
<div> // Main DIV

<div><a href="LINK">JOINED</a><a href="">UNSUBSCRIBE</a></div>
<div><a href="LINK"></a><a href="">SUBSCRIBE</a></div>
<div><a href="LINK">JOINED</a><a href="">UNSUBSCRIBE</a></div>
<div><a href="LINK"></a><a href="">SUBSCRIBE</a></div>
<div><a href="LINK"></a><a href="">SUBSCRIBE</a></div>

</div>// Main DIV


So remember, all the classes and IDs are dynamically generated and change from time to time so I cannot use them as footprint.

So the logic I would be after is going through every single line of Div, Detect if UNSUBSCRIBE exist, do nothing, If SUBSCRIBE EXIST, click it, then pause to the next one and so on....

If you could just guide me by word(without coding) so I understand how this little loops works in Zenno(check each element one by one.).

In pure coding, I would have counted all the element s in a page and then loop through but here it does not work because the page has lazy loading at the bottom(infinite loading)

Thanks
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 233
Благодарностей
5 844
Баллы
113
Why don't you just search element by Innertext? If it''s subscribe then click it.
 

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
The reason is because of this, I did not explain it well above:

4 possibilities

Joined subscribed / unsubscribed
Not Joined subscribed / unsubscribed

Both joined and not joined may be subscribed or unsubscribed.

I would only need to click on subscribed for the people who are in the "join" category.

Hence the need for me to be able to detect the closest subscribe button element in a div that surrounds the join/ not joined text.
 

Larsometer

Новичок
Регистрация
12.10.2019
Сообщения
14
Благодарностей
1
Баллы
3
So why not check innertext in the main element for "join" and "subscribe". If you find both then click.
 

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
This is where I am struggling... I cannot work out how to search for something into 1 single element, click the next closest elements(subscribe) and then go to the next one.
Any tutorial on this please?
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 233
Благодарностей
5 844
Баллы
113

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
<div> // Main DIV

<div><a href="LINK">JOINED</a><a href="">UNSUBSCRIBE</a></div> //How to select the closest "Unsubscribed" button that is from the First "JOINED" text presence?
<div><a href="LINK"></a><a href="">SUBSCRIBE</a></div>
<div><a href="LINK">JOINED</a><a href="">UNSUBSCRIBE</a></div>
<div><a href="LINK"></a><a href="">SUBSCRIBE</a></div>
<div><a href="LINK"></a><a href="">SUBSCRIBE</a></div>

</div>// Main DIV


This is what I am struggling with, the actual steps(which logic) to get "How to select the closest "Unsubscribed" button that is from the First "JOINED" text presence".

Based on the above, what would you do please?

1)Detect the text presence for "JOINED", that ok,
2)What to do in step 2 from there?

My real life problem will be more complex as they are many <ul> <li> <div> but that;s ok as long as I understand the first steps or at least the direction of finding an element that is the closest from another.

Thank you.
 

Larsometer

Новичок
Регистрация
12.10.2019
Сообщения
14
Благодарностей
1
Баллы
3
What you could try is to find the mouse coordinate of the element that you already can find. If the other one is right next to is you just need to find the pixel distance and add that to the coordinates. Then just let the mouse move there and do the click.

And case you are really desperate. Why not hire a developer to do the job? Enough freelancers out there. Am a beginner by myself and cannot take such a job.

last but not least... try regex and go from element to element. Also possible to have to rules for one "get action".
 

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
Dang, this is a brilliant idea! That's all I needed to know.
Development wise I don't think it is that complex as I build APIs and back ends all the time. This is why I would feel sad to hire a dev if myself I am a dev in something else.
I just need to learn the tricks of doing this kind of things above, the rest I can handle it......
This pixel thing, I did not know about it, this is cool! Yes this will sort the problem out for now, absolutely brilliant!

You see, as a programmer, I could have easily solve the issue of finding the element through a loop and take action, but when the loop is already parsed and it comes to regex, I am really not good at it as it is something I do not need to do in my programming.
I can only work out things before outputting them to the screen.....(loops, arrays, objects and so on...)

Thanks, thanks, and many thanks! You made my day. This software opens a kind of a 3D thinking on the problems, it is weird..... OCR, keystrokes, scroll down, now pixels....a lot of cool stuff to play with!
 

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
Well actually :-) ;-)
After writing the above text about loops, something popped up in my head......

I found a super cool solution with no error as the pixel thing did not work at all time unfortunately.

What you have to do is simply find the div that surrounds all the most important information about the button to click and the text you are looking for.
When this is selected, save the output into a variable and parse it as "text".
Do a regex on that text if NOT found, increase a variable counter(which you set at 0 first) of +1. Redo the exact same circle but thing time pass the +1 increment back to the DIV Match#(I did not know you could stick variables in that little table).
Each time add +1 and the entire page will be checked very very quickly.

In fact, it is like programming a loop in normal coding. The fifficult part is not the coding in Zenno but find out where you can place the variables. Sometime you see a spot and are not sure if you can drop things there.
Apart from that, it was a lot easier than I thought.
 

lokiys

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

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
Thanks, let me check.
 

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
Why is there PHP in the doc? We can use PHP in Zenno?
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 770
Благодарностей
1 182
Баллы
113
Why is there PHP in the doc? We can use PHP in Zenno?
PHP syntax to be exact.
Make sure that there won't be much help with developing in C# as it is an advanced way, which would not need any help LOL.
your best bet is to forum search there are a lot of examples and a lot of threads about it.
and of course any C# book/tutorials :-)
 
  • Спасибо
Реакции: bambinou

Larsometer

Новичок
Регистрация
12.10.2019
Сообщения
14
Благодарностей
1
Баллы
3
Well actually :-) ;-)
After writing the above text about loops, something popped up in my head......

I found a super cool solution with no error as the pixel thing did not work at all time unfortunately.

What you have to do is simply find the div that surrounds all the most important information about the button to click and the text you are looking for.
When this is selected, save the output into a variable and parse it as "text".
Do a regex on that text if NOT found, increase a variable counter(which you set at 0 first) of +1. Redo the exact same circle but thing time pass the +1 increment back to the DIV Match#(I did not know you could stick variables in that little table).
Each time add +1 and the entire page will be checked very very quickly.

In fact, it is like programming a loop in normal coding. The fifficult part is not the coding in Zenno but find out where you can place the variables. Sometime you see a spot and are not sure if you can drop things there.
Apart from that, it was a lot easier than I thought.
Glad to have helped you. :D Well Zenno is special in a way andit probably has to be that way. Websites are not made for using them with robots:cu: So you need to be sneaky to trick the system. Thats why there probably are not that many tutorials (world is spinning).

Also hope you "pay back" on day. Once you learn how to use magic Zenno I guess the community will highly benefit from the advice that you can give then as well.
 

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
The day I will know the software well enough, I think I will create online videos as I have various Youtube channels already.
But I first need to understand a bit more all the ins and outs of the software.
I am a bit confused with C at the moment(I find it very lengthy to write) but I am sure with time it will work out. Regarding the PHP syntax, do I drop it inside a C sharp Box? How does it works?
 

Larsometer

Новичок
Регистрация
12.10.2019
Сообщения
14
Благодарностей
1
Баллы
3
Well also an option to stay here in the forum. The more you help the more connections you can make here. I dont think that Zenno will rock on Youtube. There are tutorials from past (quite good ones actually) but not that many views. Seemsl like it is more a closed community.
 

bambinou

Client
Регистрация
22.08.2011
Сообщения
436
Благодарностей
21
Баллы
18
I had a second thought about what I said....The problem you see is that when you own this type of tool you really really want to keep it secret. So tutorials might not be a great idea as you might start having too many people using the product and shoot yourself in the foot. I would prefer make tutorials on using my bots rather than teaching people how to use Zenno, but I cannot do this either without proper rebranding(no Zenno mention in the entire installation process and folders).
I know other guys who owns automated tools like this one and tell nobody about it as it is part of their business core.
This is why we need to have a better white label rebranding solution( + better Bot UI), because we can generate sales of our bots(but not Zenno itself) as not many of us would be crazy enough to advertise Zenno(if you think logically about it).
 

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