4

I am attempting to use selenium to navigate a website that is using frames.

Here is my working python script for part 1:

from selenium import webdriver
import time
from urllib import request

driver = webdriver.Firefox()
driver.get('http://www.lgs-hosted.com/rmtelldck.html')

driver.switch_to.frame('menu')

driver.execute_script('xSubmit()')

time.sleep(.5)

link = driver.find_element_by_id('ml1T2')
link.click()

Here is the page element:

<html webdriver="true">
    <head></head>
    <frameset id="menuframe" name="menuframe" border="0" frameborder="0" cols="170,*">
        <frameset border="0" frameborder="0" rows="0,*">
            <frame scrolling="AUTO" noresize="" frameborder="NO" src="heart.html" name="heart"></frame>
            <frame scrolling="AUTO" noresize="" frameborder="NO" src="rmtelldcklogin.html" name="menu"></frame>
        </frameset>
        <frame scrolling="AUTO" noresize="" frameborder="NO" src="rmtelldcklogo.html" name="update"></frame>
    </frameset>
</html>

My issue is switching the frames...its in 'menu' I need to get into 'update':

driver.switch_to.frame('update')

^ does not work....error tells me its not there, even though we can clearly see it is...any ideas?

How do I switch from menu to update?

1 Answer 1

4

You need to switch back to the default content before switching to a different frame:

driver.switch_to.default_content()
driver.switch_to.frame("update")

# to prove it is working
title = driver.find_element_by_id("L_DOCTITLE").text
print(title)

Prints:

Civil Case Inquiry
Sign up to request clarification or add additional context in comments.

1 Comment

Ya know...I worked on this for 2 days...and I swear I tried that....thank you that worked flawlessly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.