Firefox not waiting for Pageload

Hello,
i automate tests for a large online platform that has its own GUI and have used Chrome (Version 67.0.3396.87 64bit) to design all my test cases. Now i’m supposed to start testing in Firefox (Version 61.0.1 (64-bit)).
I have run several scripts and many have run into problems.The Firefox driver doesn’t seem to wait for the loading on the GUI to finish after an action is taken.
For Example, if a click opens a new window within the GUI (not a new browser window), the driver tries to execute the next command (click on a button in the new window) before the new window is loaded, sometimes even 3 or 4 buttons before the new window is shown. This of courses causes many scripts to fail.

Hi Marco

I can assure you, the Firefox driver does not wait less time than you tell it.

I suspect the differences between how chromium and gecko lay out the page elements has conspired to kill your tests.

What you need to do, is wait for satisfactory conditions to arise in the page whose elements you want to test: arriving at these conditions can seem to take different amounts of time for different browser layout engines.

In general terms, wait for each element you are going to target in your test case before conduction any test steps in the test case.

Develop a waiting strategy for each page - be sure to wait first for the last element in the HTML, then wait for the test’s target components, one by one. For me, I wait first for a copyright message to appear which occupies the last div in the HTML and appears at the bottom of every page.

With a strategy like that, you’ll have less headaches between browsers, hopefully. And, FWIW, it works for me.

Thanks for the clarification, but i’m not sure if that helps. If i have to edit all my scripts with additional “Wait for element visible” steps, it will take weeks to update all existing scripts.
Waiting for a last element isn’t really a working solution because the platform doesn’t have different pages, it’s opening windows within one page.

Waiting for a last element isn’t really a working solution …

One way or another, you are going to have to wait for a set of conditions. That is the only “working solution” there is (using automation software which runs at hypersonic speed compared to the layout engines of browsers).

…because the
platform doesn’t have different pages, it’s opening windows within one
page.

Beyond the unlikely possibility that you have a problematic installation of the Firefox gecko driver, and whether these “windows” are actual browser windows, iframes, popup windows, divs etc doesn’t change the nature of the problem you described or the general approach I spoke about – you’re (not, but supposed to be) waiting for a change of state, from one state to another, be it a page change, a popup appearing, you name it.

If you do happen to find another way, I’d sincerely love to hear about it.

And don’t take any of this as argumentative even if it sounds like it: we’re here to help. B)

Hello,
don’t worry about me feeling attacked - I know you just try to help and i appretiate it very much :slight_smile: . I may not have given the best description so i wanted to post a screenshot to make it clearer what i mean. In the screenshot below, you can see how it looks in the browser. There is no normal right-click and the windows don’t always have useful ids or xpath values which makes using them for waiting steps difficult.
If all else fails, i will have to edit all existing scripts to add additional wait for element visible steps - But if there is an easier way (e.g. by setting some parameter in the driver) i would prefer doing that.

image.png