question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSS does not load properly if there are any assert statements related to iframe

See original GitHub issue

I have to test drag and drop functionality in a iframe. We can generate forms using this functionality. The left side of the iframe holds the widgets and the empty container in the middile and a form to the right.

TestCase: Dropping a ‘Text Area’ or any widget should load a new form with radio buttons, few input fields and a unique string dynamically (using Jquery). This form varies from widget to widget.

This dynamic form is not loading properly in some cases. The radio buttons are displayed as input field of type text.

What I observed is that the rendering of this form fails if I am trying to perform any element presence or trying to use getText(), isPresent() or sendKeys() (on the elements inside the iframe) after switching into the iframe.

Scenario 1: OK Form is loading properly var widgets = element.all(by.css('css')); var emptyContainer = element.all(by.id('id')); widgets.each(function(widget){ browser.actions().mouseDown(widget).mouseMove(emptyContainer).mouseUp().perform(); });

Scenario 2: FAIL In this case, the form and it’s components(radio buttons, unique number) are loaded properly for the first iteration and for the rest(12) the radio buttons are loaded as input field of type text. You can see I am testing radio button presence for each widget. browser.driver.switchTo() .frame('frameName').then(function(){ var widgets = element.all(by.css('css')); var emptyContainer = element.all(by.id('id')); widgets.each(function(widget){ browser.actions() .mouseDown(widget) .mouseMove(emptyContainer) .mouseUp() .perform() then(function(){ var radioButton = element(by.css('css')); radioButton.isPresent().then(function(ispresent){ expect(ispresent).toBe(true); }); }); }) });

Scenario 3: FAIL In this case I am trying to find if a widget is present or not. I am doing this before performing drag&drop. browser.driver.switchTo() .frame('frameName').then(function(){ var widgets = element.all(by.css('css')); var textAreaWidget = element(by.id('id')); textAreaWidget .isPresent().then(function(ispresent){ expect(ispresent).toBe(true); }); var emptyContainer = element.all(by.id('id')); widgets.each(function(widget){ browser.actions() .mouseDown(widget) .mouseMove(emptyContainer) .mouseUp() .perform() then(function(){ var radioButton = element(by.css('css')); radioButton.isPresent().then(function(ispresent){ expect(ispresent).toBe(true); }); }); }) });

The jquery execution is terminated somehow if I am trying to do anything other than dropping the widgets. Is there any way to wait for jquery to complete it’s execution on iframe?

Bug report

  • Node Version: 8.11.3
  • Protractor Version: 5.3.2
  • Browser(s): chrome 67.0.3396.99
  • webdriver-manager: 12.1.0

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
CrispusDHcommented, Aug 14, 2018

@autowala What do you mean when say that protractor does not wait for jquery? What is jquery for you? You always could find source of isPresent etc. and take a look at code to figure out what is happen there 😃

0reactions
autowalacommented, Aug 16, 2018

replacing isPresent with browser.isElementPresent solved the issue partially. isPresent will wait for the angular if this is the problem I’m using coun() then calling count() should also cause the issue in my case. Currently i’m trying to find alternative for getText. It seems browser.getText is deprecated in the latest version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iframe element is breaking live CSS loading #7935 - GitHub
After several hours of trying to figure out why my stylesheet was no longer updating in live dev, I narrowed it down to...
Read more >
Detect failure to load contents of an iframe - Stack Overflow
It is very common issue when we are opening a link inside an iframe and that page not get loaded due to XFRAME=sameorigin...
Read more >
Working with iframes in Cypress
In this blog post I will show how to interact with DOM elements inside an iframe ... iframe when it sees a Cypress...
Read more >
Handling iFrames Using Selenium WebDriver switchTo ...
Handling iFrames Using Selenium WebDriver swtichTo() method. iFrame (inline frame) is a HTML document embedded within another HTML document.
Read more >
Content Security Policy: Embedded Enforcement
Don't cite this document other than as work in progress. ... If no such assertion is present, the response will be blocked.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found