im trying to figure out how to make a loop that reloads a page until a element is present, when the element is found the script should go on to the lines behind the loop. the loop is for an autocop bot, so the element isnt on the page at first until the item drops.
I now have this:
from config import keys
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
import time
def order(k):
d = driver.get(k['product_url'])
elements = driver.find_element_by_partial_link_text(k["key_words"])
for product in elements:
if element = {detected}
print('found product')
else:
driver.refresh()
print('refreshing...')
elements.click()
diver.close()
if __name__ == '__main__':
driver = webdriver.Chrome('./chromedriver')
order(keys)
I know the script still has a lot of errors and some of the superfluous import are from earlier tries. I hope someone could help me with getting this code to work.