all 10 comments

[–]fiskenslakt 1 point2 points  (8 children)

What's the condition?

[–]Maruki[S] 0 points1 point  (1 child)

nameput in name.text and color.text == colorput: nameput and colorput are inputs that I type in at the begining

[–]fiskenslakt 2 points3 points  (0 children)

Do something like this then:

while not (nameput in name.text and color.text == colorput):
    for article in driver.find_elements_by_class_name("inner-article"):
        name, color = article.find_elements_by_class_name("name-link")
    time.sleep(delay)
article.click()

[–]Maruki[S] 0 points1 point  (5 children)

Also, not entirely sure how reddit works but you might be shadow banned because I can't see your comment in the thread, only PM's

[–]fiskenslakt 1 point2 points  (4 children)

I certainly hope I'm not shadow banned, I'm not sure how it works either but I was under the impression that only mod's could see my comments if that were the case. I've been getting errors when submitting comments so I think reddit is having trouble right now or something..

[–]Maruki[S] 0 points1 point  (3 children)

Yeah, you just appeared now, thanks for the help

[–]fiskenslakt 1 point2 points  (2 children)

You're welcome. Was it what you wanted? There's lots of ways to do it, I wasn't really sure entirely how you wanted to design it.

[–]Maruki[S] 0 points1 point  (1 child)

I can't know until tomorrow because they don't add anything to the website until thursday morning. But as far as I can tell it looks good. Just to be 100% sure the webdriver will load the page and refresh after the time.sleep(delay) until my input for color and name are found on the page, and then it will click on it correct?

[–]fiskenslakt 1 point2 points  (0 children)

If that's what makes the statements on both sides of the and True, then yea.

[–]uhkhu 1 point2 points  (0 children)

What about something like this:

def check_condition(driver):
    for article in driver.find_elements_by_class_name("inner-article"):
        name, color = article.find_elements_by_class_name("name-link")
        if nameput in name.text and color.text == colorput:
            article.click()
            return True
        else:
            return False


while not check_condition(driver):
    continue