Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

This is the HTML file I have. I am trying to use Selenium-Webdriver API along with ChromeDriver to send_keys to an input filed inside the <body>. But I can't access anything which is inside of #document. I cannot figure out why. Can someone please tell me what this #document means and how can I access any of the elements inside this using Selenium.

<html>
<head>…<head>
<frameset >
    <frame>...</frame>
            <frame name="mainFrame" src>
                #document
                    <html>
                      <head>…</head>
                      <body>…</body>
                    </html>
        </frame>
    </frameset>
</frameset>

This is a router webpage, the actual webpage is HUGE, so I haven't pasted it here.

The router webpage

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
444 views
Welcome To Ask or Share your Answers For Others

1 Answer

Just to summarize on what I learnt and implemented.

  1. document is a virtual element, which doesn't really mean anything.

  2. If you have mulitple frames/framesets, you will have to switch frames.

    a. so first get to the default content. driver.switch_to_default_content()

    b. then get to the frame that you want to work with. frame = driver.find_element_by_name('mainFrame')

  3. Then play with the elements in that frame.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...