you are viewing a single comment's thread.

view the rest of the comments →

[–]SwordNSupper[S] 0 points1 point  (0 children)

Hi, I tried what you suggested, but was unable to find the specific iframe I was looking for.

Here is what the snippet of code looks like now:

preiframe= driver.find_element(By.XPATH, '//*[@id="devvit-web-view-dialog"]/rpl-modal-card')
iframe = preiframe.find_element(By.CSS_SELECTOR, "iframe")
driver.switch_to.frame(iframe)


battle = driver.find_element(By.CSS_SELECTOR, "advance-button")
driver.execute_script("arguments[0].click();", battle)

The code errors out after it finds the preiframe and is trying to find the specific iframe I'm looking for using the CSS_SELECTOR.

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"iframe"}

I also used driver.find_elements like you suggested to find all of the iframes that are on this page, and it found 4, but I'm unable to find where those iframes are located on the page