Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions