Click Button as long as Button is available python selenium

I’m currently doing a small Python Script for my Boss, and in general i just need to click a Button on a Website to load more Objects. There are like 50 Objects automatically showed, but u can click on “more” till there are like 5000 objects.

How can i check if the Button is still on the page or rather clickable for my While loop.

button = driver.find_element(By.ID, "mod-LoadMore--button")

while *button is available*:
    button.click()

I tried it with:

while button != None:

and stuff, but not figured out how to exactly do it…
Hope u can help me with this

Read more here: Source link