User8392 - 11 months ago 60
Python Question

# How to identify and switch to the frame source in selenium

I have been using the selenium and Python2.7, the Firefox.

I want to think that the work, such as the following.
However, I do not know how to write code(#).

Driver.get('https://video-download.online')
Driver.find_element_by_id("submit").click()
time.sleep(5)
#[Click]Proceed button


Help me, plz...

You are able to get frame locator value in HTML code which is specified in iframes tag. u can move up from where your locator value is existed in HTML code.

This function is suitable:

def frame_switch(css_selector):
driver.switch_to.frame(driver.find_element_by_css_selector(css_selector))


If you are just trying to switch to the frame based on the name attribute, then you can use this:

def frame_switch(name):
driver.switch_to.frame(driver.find_element_by_name(name))