samedi 25 avril 2020

Python passing javascript to true/false

So I am trying to create a python program that checks if an item is instock or out of stock. To do this I use the selenium chrome web driver. In order to check if an item is in stock, I use this code:

print(driver.execute_script("return document.body.innerText.includes('sold out')"))

I wish to use this in an if statement so I can make it run a Discord webhook if it comes back true/false.

if(driver.execute_script("return document.body.innerText.includes('sold out')" == 'False')):

The code without the if statement runs fine.




Aucun commentaire:

Enregistrer un commentaire