How to get rid of the selenium departure in case of not finding element?

Hello, recently started playing one browser game and I was impatient to write a bot for this information HABR without thinking made simple Crafter whose essence just the push of two buttons, but here's the problem I faced is the search for things in the backpack and when the desired things no the script simply crashes and refuses to work, in fact that's the whole problem
June 14th 19 at 19:11
2 answers
June 14th 19 at 19:13
try-catch-exception-finally statement ?
This is exactly what I needed, thanks! - nikita.Stracke commented on June 14th 19 at 19:16
June 14th 19 at 19:15
you can write a function checking the item, before you click(or just to interact with the item) to test this function whether element is this and is it available. The basis functions also have a try-catch-exception and a few if else.

Find more questions by tags PythonSeleniumWeb Development