codesidian / Python-MissionChiefBot

A Python bot for the online game MissionChief
Other
12 stars 15 forks source link

Large vehicle lists not rendering in time. #24

Closed codesidian closed 4 years ago

codesidian commented 4 years ago

When a user has a large number of vehicles, the page doesn't render it time for out browser script to execute which throws a ElementClickInterceptedException since the checkbox isn't in view (I assume).

This is the last thing we need to fix before we can merge into master from the selenium-port branch.

jackbayliss commented 4 years ago

Needs testing to check if the checkbox is existent.

On 13 Feb 2020, at 10:55, Joshua Latham notifications@github.com wrote:

 When a user has a large number of vehicles, the page doesn't render it time for out browser script to execute which throws a ElementClickInterceptedException since the checkbox isn't in view.

This is the last thing we need to fix before we can merge into master from the selenium-port branch.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

codesidian commented 4 years ago

I don't think we should be looking for it if it doesn't exist. That would mean that vehicle isn't dispatchable, which we should be already be aware of.

jackbayliss commented 4 years ago

@codesidian I’ve come across it before, and when checking via inspect element the actual checkbox didn’t exist on the page. Not sure if this could be because of enabled settings etc. But I’ll look into it. Also if a user despatches something outside of the bot it would not have knowledge of it being despatched- so I think an exception would be best, then if it’s not there continue to the next checkbox- or if not an exception at least an if statement to check it exists before trying to click

codesidian commented 4 years ago

You're right, user interaction would mess up the integrity. As far as the checkbox not being there, I can only think of that being the cause. Otherwise, we'll have to determine why that's happening.

For now, we can make sure the elements are available to be interacted with and log warnings. On a failure of finding the vehicle to dispatch, we could also find a suitable replacement to ensure that the mission is fulfilled since if we keep trying to dispatch on a mission but keep hitting the same unavailable vehicle the mission will never be fulfilled.

On top of that, the reason why it isn't there should be determined and the vehicle set unavailable if appropriate. I would even say a recheck of that current vehicles details including to see if it exists anymore because if we need to take user interaction into account, vehicles can be created or destroyed.

jackbayliss commented 4 years ago

Personally I'd say keep the ElementClickInterceptedException, or do a pre-check that the element is existent.. should take a seconds so i'll write it up in a sec.

jackbayliss commented 4 years ago

Have tried to cover any possible errors with the following https://github.com/codesidian/Python-MissionChiefBot/commit/b941b37eda1aa25d75e63530caf1a7eea524122b

This should prevent any absolute crashes of the script due to a checkbox, even if a checkbox cannot be found the script should continue as this only occurs on huge accounts it shouldn't make much difference.