4

I got this html (It's simplified to see the deep)

<html>
    <frameset>
        <frame>
            #document
                <html>
                    <body>
                        <div>
                            <form>
                                <table>
                                    <tbody>
                                        <tr>
                                            <td>
                                                <input :) >
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </form>
                        </div>
                    </body>
                </html>
        </frame>
    </frameset>
</html>

And when i run this commands i get the following:

@browser.element(:xpath => "/html").exists? => TRUE

@browser.element(:xpath => "/html/frameset").exists? => TRUE

@browser.element(:xpath => "/html/frameset/frame").exists? => TRUE

@browser.element(:xpath => "/html/frameset/frame/html").exists? => FALSE

The #document apparently is hiding the rest since after that, the rest is FALSE. I tried to get the Xpath with Chrome by left click on the code but i get the "inner code" like from the second html and not from the first.

Question

How can i access the input of that code?

*If i run @browser.frame.text.include? Something where the "Something" is inside the table, it returns TRUE.

closed as off-topic by Michael Durrant, alecxe, NarendraC, c32hedge, IAmMilinPatel Aug 8 '17 at 2:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development unrelated to testing are off-topic here, but can be asked on Stack Overflow." – Michael Durrant, alecxe, NarendraC, c32hedge, IAmMilinPatel
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Hello, if this site is hosted on internet then it would be better if you share the URL and exact element that you are trying to locate. Because suggestion provided on the basis of above might or might not work for you. – Aalok Jun 25 '17 at 3:28
  • Try starting from //frameset/frame. Also do the framesets have any ID's you could use ? – Michael Durrant Jul 6 '17 at 19:08
  • Thanks for the replies. The site is hosted on the internet but you can access to it directly with the UR :( ; There is no ID to use :( ; Will try your suggestion when i can ;) – user25268 Jul 7 '17 at 21:17
  • I Googled for "Selenium inner frame" and found stackoverflow.com/questions/15464808/…. – user246 Aug 8 '17 at 2:32
0

I believe the problem arises because a frame is a holder for a complete html document inside the one initially connected to.

Try setting a variable to the frame itself:

target_frame = @browser.element(:xpath => "/html/frameset/frame")

And then you should be able to see the document inside the frame:

frame_html = target_frame.html

I'm winging this off the top of my head but I think it is in the ballpark (sorry about the scrambled metaphors...)

  • Thanks for the answer. I don't have time to try this at the moment but i will when i can. – user25268 Jul 7 '17 at 21:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.