Function driver.switchTo.frame() not working in Selenium

16,828

Solution 1

That's because you're using Java method. In Python you should use

driver.switch_to.frame("frame_name")

Solution 2

switchTo() is not a Python method. You should try

browser.switch_to.frame("frame");

Solution 3

I know this might be an older question, but encountered this myself today, so wanted to share the built-in methods for this when using python. A good IDE helps:

Switch To Options in Python

Solution 4

You can use this code:

driver.switch_to_frame("frameName")

For more information please go through this link:

http://selenium-python.readthedocs.io/navigating.html

Share:
16,828
Rahulkumar Budhwani
Author by

Rahulkumar Budhwani

Updated on June 14, 2022

Comments

  • Rahulkumar Budhwani
    Rahulkumar Budhwani almost 2 years

    When I try to switch to frame on the webpage using Webdriver in selenium in Python, it show me the error. Please find my code below:

    driver.switchTo().frame("frame");
    

    AttributeError: 'WebDriver' object has no attribute 'switchTo'