Home > Mobile >  Change to iframe in selenium
Change to iframe in selenium

Time:01-30

enter image description here

CodePudding user response:

Element you are trying to access is located inside nested iframe, one iframe insde another iframe.
You should switch to the first iframe, then to the inner iframe and then to click the "Get cookies" button.
This should work:

wait = WebDriverWait(driver, 20)
wait.until(expected_conditions.frame_to_be_available_and_switch_to_it((By.XPATH, '//iframe[@]')))
wait.until(expected_conditions.frame_to_be_available_and_switch_to_it((By.XPATH, "//iframe[contains(@src,'plus')]")))
wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="save-all-conditionally"]'))).click()

When you finished working inside that iframe you will have to switch to the default context with

driver.switch_to.default_content()
  •  Tags:  
  • Related