Linked Questions

Popular Questions

I have this test spec:

Scenario "preview offer", js: true do
    ...

    When "I click onto the contact details tab" do
      within_frame "preview-iframe" do
        click_link "Enter details"
      end
    end
    ...
end

But it throws an exception:

Failures:

  1) Preview Offer preview coaching offer booking with Journeyman enabled
     Failure/Error: button.click

     Selenium::WebDriver::Error::ElementNotInteractableError:
       Element <a href="/offers/details"> could not be scrolled into view

The actual html is:

<iframe frameborder="0" id="preview-iframe" name="preview-iframe" scrolling="no" src="/offer">
    ...
        <ul class="list-steps">
            ...
            <li data-page="enter-details">
              <a href="/offers/details">Enter details</a>
            </li>
            ...
        </ul>
    ...
</iframe>

I have try to be more specific for the test case as:

When "I click onto the contact details tab" do
  sleep 5
  execute_script "window.scrollBy(0,500)"
  within_frame "preview-iframe" do
    button = find("#body > div > header > div > div.header__bar > ul > li:nth-child(2) > a")
    button.click
  end
end
  • I added sleep 5 because to give times to iframe content to be fully loaded
  • added scroll to ensure the page is scrollable to the view?
  • specified the button to be click

But still got the same error, I use selenium as the web driver, anyone has this issue?

thank you

Related Questions