So I have been trying to play around with the function in Selenium that is called:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[@class='nsg-button nsg-bg--black register-next-step-cta js-nextStepCta' and contains(.,'FORTSÄTT')]")))
Before I'm starting to say the issue. What I'm trying to do a Selenium of is to basically make a Selenium that automatic write to the forumlar in this picture:
Which isn't any complications. However whenever I press "Skapa Konto", It loads and waits until a new page comes up which is:
But the issue is that sometimes it gets and error and gives a picture that is saying:
Basically what I need to do is to press Dismiss this error and press again on "SKAPA KONTO" with a random delay click between 1-10 secs and see if there is the same error or successful. Basically the idea is if its successful. Just continue do the rest of the script with works fine. And then whenever this error pops out. Press the Dismiss this error and press "SKAPA KONTO" again which is:
WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@value='CREATE ACCOUNT']")))
Update:
Stupid of me! So I forgot to add the HTML for the error which is:
<span class="nike-unite-h1-no-image">An error occurred.</span>
<input type="button" value="Dismiss this error">
So how would I make it possible that it retries until it gives me successful and continues the code?
Aucun commentaire:
Enregistrer un commentaire