Search code examples
pythonseleniumjspselenium-webdriverframes

How to switch between frames using selenium library with Python?


I trying to switch frame "top" to "body". I tried different ways but I couldn't do it. There is too much source but any of them not working. What is the problem with it? HTML structure is in the link. Page is "jsp".

# 1 
driver.switch_to_frame("body")

# 2
wait.until(EC.frame_to_be_available_and_switch_to_it((By.XPATH,"/html/frameset/frame[3]")))

Maybe the problem is visibility?


Solution

  • Switch to default content from frame "top" and then switch to "body".

    driver.switch_to_default_content()