Farm Manager - Tribal Wars 2 Farmbot (old version from 2018)

Still not loading and getting the same errors.

I don’t know why but it doesn’t switch villages.Could you help me?

Hi @Mark,
looking at this screenshot, it seems like there was a problem when transferring the new version of the app.
Can you download the app from https://botengine.blob.core.windows.net/blob-library/by-name/BotEngine.v2018-12-28.Mark.exe ?
How does the app window look like then?

Yes when I have the bot log I can help you.
What text is in the bot log when the bot failed to switch villages?

Ok I simply fixed it by adding few lines of code

It is doing better thnx

20-18-24.980: Bot operation started in session 4a6368bdf3044a3d.
20-18-26.986: Welcome! - ÂĄBienvenido! - Bienvenue! ---- This is the Tribal Wars 2 Farmbot. I read your battle reports and send troops to your farms again. To learn more about how I work, see Testing the Tribal Wars 2 Farmbot 2018. In case you have any questions, feel free to ask at https://forum.botlab.org
20-18-33.109: Looks like opening the web browser was successful.
20-18-33.137: Starting cycle 0 of 1000.
20-18-34.249: I did not find the button to open the report list. Maybe the game is still loading. (The location of the current page is ‘about:blank’). If you have not done this yet, please log in and enter the game in the web browser I opened when the script started. For now, I keep looking for that button to appear…
20-18-49.677: I did not find the button to open the report list. Maybe the game is still loading. (The location of the current page is ‘The medieval online strategy game - Tribal Wars 2’). If you have not done this yet, please log in and enter the game in the web browser I opened when the script started. For now, I keep looking for that button to appear…
20-19-07.377: I did not find the button to open the report list. Maybe the game is still loading. (The location of the current page is ‘https://en.tribalwars2.com/game.php?world=en41&character_id=1064021’). If you have not done this yet, please log in and enter the game in the web browser I opened when the script started. For now, I keep looking for that button to appear…
20-19-07.915: Found the button to open the report list.
20-19-07.915: Please configure filtering in the reports list now. I will wait for 10 seconds before continuing. In case you need more time to configure the game, you can pause the bot.
20-19-17.926: Url without character id: ‘https://en.tribalwars2.com/game.php?world=en41&character_id’
20-19-19.215: Found the button to open the report list. I click on this button…
20-19-26.621: Found at least one report item in the reports list.
20-21-01.928: Number of parsed report items: 100
20-21-01.928: Found a report in the report list. I click on it.
20-21-02.513: Failed to hover or click on attempt 1 with exception:
System.AggregateException: One or more errors occurred. —> PuppeteerSharp.PuppeteerException: Node is detached from document
at PuppeteerSharp.ElementHandle.d__26.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at PuppeteerSharp.ElementHandle.d__24.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at PuppeteerSharp.ElementHandle.d__11.MoveNext()
— End of inner exception stack trace —
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Submission#0.AttemptClickAndLogError(Func`1 getHtmlElement)
—> (Inner Exception #0) PuppeteerSharp.PuppeteerException: Node is detached from document
at PuppeteerSharp.ElementHandle.d__26.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at PuppeteerSharp.ElementHandle.d__24.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at PuppeteerSharp.ElementHandle.d__11.MoveNext()<—

20-21-02.571: In the current cycle, I have looked at 0 reports and sent 0 attacks from 0 villages.
20-21-02.601: In this session, I have looked at 0 reports and sent 0 attacks from 0 villages.
20-21-05.864: Caption of the current open report: ‘’
20-21-06.241: Did not find details container in battle report. Maybe this is a different kind of report, so I continue with the next report.
20-21-08.985: Did not find the button to navigate to the next report. I stop this cycle.
20-21-08.997: In the current cycle, I have looked at 0 reports and sent 0 attacks from 0 villages.
20-21-09.009: I am done with this cycle. I will wait for 74 minutes before continuing…

VIIR, still having this problem, now I saw no movement at all when it happend

1 Like

The error message looks like the game did remove the node in the html document between reading the node and the bots attempt to click on it. As far as I remember, the bot should pick the first report in the list.
I remember multiple possible scenarios in which the html node could disapear:

In your log, I see that about half a minute passes when parsing the report list entries. In case the game recreates the html node in the meantime, we might be able to avoid the problem by making the parsing faster or by reading the first report node again.

@bdc, how does it look like when you configure the game to only display 25 reports in the list?

(The parsing step should only take about 1/4 of the time compared to the list with 100 reports, so maybe this will be fast enough)

Also, if you have not already, please load the newest version of the app from https://botengine.blob.core.windows.net/blob-library/by-name/BotEngine.v2018-12-27.exe
(The browser interface has changed since the last version and therefore the parsing step could be faster with version 2018-12-27)

To author
Love your farm manager bot.
Is it possible to implement a “saving fleet” - to send resources to another village and/or spend resources… at a specific time.
Playing on INTERNATIONAL world, we have players farming other humans while we are asleep.

ok I will try that. I will let you know from the moment I have done it

started with new bot, and 25 reports per page, must say no issues with this startup…
and indeeds works ALOT faster

1 Like

bot%20error
i got this fault happening now… weird is the bot continues its work when the popup comes on the screen

1 Like

Looks like handling of those error messages can be improved. Perhaps in this case they are better only written to the log file, as the bot continues operation anyway.

VIIR, i have an other problem going on.
Each time when the bot askes the browser to reload, it crashes…

As long as the bot doesnt ask for a reload no problem it works great. but if it dares to ask for reload… it goes into fault.error.txt (6.9 KB)
and the popup is also annoyingm it happens on a frequent base
Could you take a look at it please?

1 Like

hello VIIr,
i went back to the older bot, and runthat one on the new farnscript. That bot doesnt go into fault when the webbrowser reloads…
any reason why?
And the popup is also not hapening with the old bot

Thank you for the report @bdc, this was very helpful to track down the root cause.
It turned out that the connection between app and browser was closed after some time of inactivity. I implemented a new version of the app which prevents this.
You can download this new version here:
https://botengine.blob.core.windows.net/blob-library/by-name/BotEngine.v2019-01-05.exe

I also removed these popups in the new version linked above. The app now writes those error messages into a log file, which is created in the log directory when the app starts.

There were many changes between those two versions of the browser interface. There are several people working on these implementations and I am not familiar with all the changes.

In case you encounter any problems with version 2019-01-05, I will look into that.

ok i will test it with that one

Hello Viir,

Seems to working good… havent seen any problem yet

1 Like