Tribal wars 2 bot(learning)

Hello, I am a player of tw2 and I was looking to make my own bot… I can say your it`s pretty well coded :). I do have some experience with python and selenium but I have a difficult time understanding how to interact with hidden obj. (for example all villages are hidden elements until you click on them) If you could give an advise would be great. As well any tip how to calculate distance or make difference between barbarian village and player village.

Regards

Here is an example reading the villages independent of their visibility in the game client: bots/implement/applications/tribal-wars-2/tribal-wars-2-farmbot at 0868deb15b5a9cc1b4e2757b45b5cd7fc3478c24 · Viir/bots · GitHub

That bot runs javascript snippets in the web browser to read information about the game. This way you also get all villages data.
Here is how it gets a list of your villages: