Question: I need help writing code for a bot i have made in PYTHON. The problem is right now that I am trying to search for

I need help writing code for a bot i have made in PYTHON. The problem is right now that I am trying to search for item on webpage and if not found refresh that web page until when the web page loads the item is there. I have an if statement right now that when not found it refreshes but it only refreshes one time. I need it to continue refreshing until that item is found.

items = driver.find_elements_by_xpath("//article[.//a[contains(.,'MLK')]][.//a[.='Rainbow']]//a")

if items:

items[0].click()

else:

driver.get("http://www.supremenewyork.com/shop/all/sweatshirts")

That is the code I have now for refreshing if not found. Only refreshes once if someone could help me and let me know the correct code i need to have it refresh until item is found that would be great. Thank You

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!