Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to click on a link inside iframe #165

Open
rsjavier14 opened this issue Jun 19, 2017 · 2 comments
Open

How to click on a link inside iframe #165

rsjavier14 opened this issue Jun 19, 2017 · 2 comments

Comments

@rsjavier14
Copy link

Hello everyone.
I have a problem, I can not click inside an <iframe> tag. Any idea how to do it?
I am using bamboo for sending emails in phoenix frameword.
this is my config in test

# Feature tests lib
config :hound,
  driver: "selenium",
  browser: "chrome"

This is the code generated to view emails, using Bamboo.LocalAdapter

<section class="email-preview-pane">
  <section class="email-preview-hero">
    <span class="email-preview-subject">Confirm account</span>
    <span class="email-preview-recipients">
      From <strong>no-reply@....</strong>
      to <strong>r@r.com</strong>
    </span>
    <span class="email-preview-headers"> 
    </span>
  </section>

  <section class="email-preview-bodies-container">
    <h3 class="email-preview-body-label">HTML body</h3>
    <p class="email-preview-body">
      <script>
        function adjustFrameHeight(iframe) {
          var body = iframe.contentWindow.document.body;
          iframe.style.height = (body.scrollHeight + body.offsetHeight - body.clientHeight) + "px";
         }
      </script>
      <iframe onload="adjustFrameHeight(this)" src="/sent_emails/kMVBwcleeMsa7KOB/html">
        <html>
          <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width">
         </head>
         <body>
           <p>
              <a href="http://localhost:4000/confirm-account..." class="link" target="_parent">Confirm account</a>
            </p>
            <iframe src="/phoenix/live_reload/frame" style="display: none;"></iframe>
          </body>
        </html>
      </iframe>
    </p>
    <h3 class="email-preview-body-label">Text Body</h3>
     <p class="email-preview-body"></p>
  </section>
</section>
@darksheik
Copy link
Contributor

Play around with these Window helpers:

        Window.window_handles |> hd |> Window.focus_window
        Window.focus_frame(1)

@rsjavier14
Copy link
Author

Thanks for your help. I now discover that it works with focus_frame.
This issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants