#πŸ”’ Selenium glitch?

4 messages Β· Page 1 of 1 (latest)

sleek salmon
#
    while True:
        try:
            res = driver.execute_script("return document.querySelecto.dataset['sitekey']")

            if res == key:

                iframe = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[1]/iframe')))
                driver.switch_to.frame(iframe)
                WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div/div[1]/div[1]/div/div/div[1]"))).click()

                break
        except:
            driver.get(url)
            time.sleep(1)
            driver.execute_script(script)
            time.sleep(1)
``` This is my code ```py
iframe = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[1]/iframe')))
driver.switch_to.frame(iframe)
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div/div[1]/div[1]/div/div/div[1]"))).click()``` Whenever i implement this thing in my code, after I finish doing my task it doesn't print the text it has to print(in another func) and it doesn't even close it. But when I don't implement that code in my code, everything works normally, with no problems!
manic bridgeBOT
#

@sleek salmon

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

manic bridgeBOT
#

@sleek salmon

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.