codesidian/Python-MissionChiefBot

Large vehicle lists not rendering in time.

Closed this issue · 6 comments

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.

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.

@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

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.

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.

Have tried to cover any possible errors with the following b941b37

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.