MarketSquare / robotframework-browser

Robot Framework Browser library powered by Playwright.
Apache License 2.0
522 stars 105 forks source link

using browser library from robotframework-browser version v13.2.0 docker image failing with initializing Browser failed error #3181

Closed ghost closed 12 months ago

ghost commented 12 months ago

Describe the bug Using robotframework-browser:v13.2.0 with node version = v16.17.1 failing with following error when referring Library Browser in settings.resource file

Initializing library 'Browser' with no arguments failed: TypeError: Formatter() takes no arguments Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/Browser/browser.py", line 798, in init Formatter(self), TypeError: Formatter() takes no arguments

Settings Library JSONLibrary Library RequestsLibrary Library DebugLibrary Library String Library Browser Library OperatingSystem

To Reproduce Steps to reproduce the behavior:

  1. install robotframework-browser v13.2.0 docker image
  2. Refer Library Browser in settings.resource
  3. While running the tests it failed with the above error

Expected behavior It shouldn't fail

aaltat commented 12 months ago

We don’t support old versions of Browser library, please retest with the latest version 17.5.2

ghost commented 12 months ago

Thanks @aaltat for the reply. It's working flawlessly until last week. Between we are using robotframework-browser==14.1.0 in requirement.txt. Don't know why it's failed all a sudden. I am curious to know why it is failing suddenly as docker image is same. Any pointers would be greatly appreciated

aaltat commented 12 months ago

Now I remember, that old version doesn’t have AssertionEngine pinned. Install AssertionEngine version 2.0, instead of 3.0 (after Browser install) and problem should be resolved.

ghost commented 12 months ago

Spot on I just seen that here https://github.com/MarketSquare/robotframework-browser/blob/v13.2.0/Browser/requirements.txt robotframework-assertion-engine >= 0.5.1

Thanks

aaltat commented 12 months ago

Or that version too should be OK too.

Because issue is resolved, I am closing issue

aaltat commented 12 months ago

Bu just want to say that t I feel that easiest and recommended option would be to upgrade to the latest Browser library version.

Sandeep-QA commented 12 months ago

Hi @aaltat We are also facing similar issue, suite was working fine till yesterday. All of sudden it started failing with below error message

Initializing library 'Browser' with arguments [ strict=False | run_on_failure=take screenshot on test failure | jsextension=/platform/../../scripts/jsextension/index.js ] failed: TypeError: Formatter() takes no arguments
09:58:32  Traceback (most recent call last):
09:58:32    File "/usr/local/lib/python3.8/dist-packages/Browser/browser.py", line 729, in __init__
09:58:32      Formatter(self),
09:58:32  TypeError: Formatter() takes no arguments

On trying to update to latest robotframework-browser version getting below error

File "/home/pwuser/.local/bin/rfbrowser", line 5, in <module>
18:54:02      from Browser.entry import run
18:54:02  ImportError: cannot import name 'run' from 'Browser.entry' (/usr/local/lib/python3.8/dist-packages/Browser/entry.py)
aaltat commented 12 months ago

The installation problem is different problem, open new issue about it. Also provide steps how to reproduce the problem.

ghost commented 12 months ago

Hi @aaltat We are also facing similar issue, suite was working fine till yesterday. All of sudden it started failing with below error message

Initializing library 'Browser' with arguments [ strict=False | run_on_failure=take screenshot on test failure | jsextension=/platform/../../scripts/jsextension/index.js ] failed: TypeError: Formatter() takes no arguments
09:58:32  Traceback (most recent call last):
09:58:32    File "/usr/local/lib/python3.8/dist-packages/Browser/browser.py", line 729, in __init__
09:58:32      Formatter(self),
09:58:32  TypeError: Formatter() takes no arguments

On trying to update to latest robotframework-browser version getting below error

File "/home/pwuser/.local/bin/rfbrowser", line 5, in <module>
18:54:02      from Browser.entry import run
18:54:02  ImportError: cannot import name 'run' from 'Browser.entry' (/usr/local/lib/python3.8/dist-packages/Browser/entry.py)

@Sandeep-QA after robotframework-browser library is installed you can try installing robotframework-assertion-engine==2.0.0 that would solve the below issue.

TypeError: Formatter() takes no arguments 09:58:32 Traceback (most recent call last): 09:58:32 File "/usr/local/lib/python3.8/dist-packages/Browser/browser.py", line 729, in init 09:58:32 Formatter(self), 09:58:32 TypeError: Formatter() takes no arguments

But other issue you reported about installing newer version should be a new issue

Sandeep-QA commented 12 months ago

Hi @aaltat We are also facing similar issue, suite was working fine till yesterday. All of sudden it started failing with below error message

Initializing library 'Browser' with arguments [ strict=False | run_on_failure=take screenshot on test failure | jsextension=/platform/../../scripts/jsextension/index.js ] failed: TypeError: Formatter() takes no arguments
09:58:32  Traceback (most recent call last):
09:58:32    File "/usr/local/lib/python3.8/dist-packages/Browser/browser.py", line 729, in __init__
09:58:32      Formatter(self),
09:58:32  TypeError: Formatter() takes no arguments

On trying to update to latest robotframework-browser version getting below error

File "/home/pwuser/.local/bin/rfbrowser", line 5, in <module>
18:54:02      from Browser.entry import run
18:54:02  ImportError: cannot import name 'run' from 'Browser.entry' (/usr/local/lib/python3.8/dist-packages/Browser/entry.py)

@Sandeep-QA after robotframework-browser library is installed you can try installing robotframework-assertion-engine==2.0.0 that would solve the below issue.

TypeError: Formatter() takes no arguments 09:58:32 Traceback (most recent call last): 09:58:32 File "/usr/local/lib/python3.8/dist-packages/Browser/browser.py", line 729, in init 09:58:32 Formatter(self), 09:58:32 TypeError: Formatter() takes no arguments

But other issue you reported about installing newer version should be a new issue

Yes, robotframework-assertion-engine==2.0.0 worked. Thanks @aaltat and @PrasannanjaneyuluPadavala-EN0195

rhaladej-cen55759 commented 12 months ago

Dear @aaltat , sorry to reopen this bug, but Closed issues or notes on Slack might be hard to spot on. In our company, a new release is deployed only after analysis and testing - from time to time backwards incompatible changes appear in the library. So we can't always adopt the latest release. Shouldn't we yank all previous releases on Pypi?

ghost commented 12 months ago

Dear @aaltat , sorry to reopen this bug, but Closed issues or notes on Slack might be hard to spot on. In our company, a new release is deployed only after analysis and testing - from time to time backwards incompatible changes appear in the library. So we can't always adopt the latest release. Shouldn't we yank all previous releases on Pypi?

Yeah version pinning of external or other dependent libraries is good to prevent backward incompatibility

aaltat commented 12 months ago

Shouldn't we yank all previous releases on Pypi?

No we won’t. I did explain it in slack, but copy paste in here too.

Why not? People are still using those versions and many people use version pinning regularly. It has many nice tools built around, example https://github.com/jazzband/pip-tools Therefore yank would cause harm to those people who are using the older version by purpose.

Also Browser library which has had the AssertionEngine pinned has been available for a month and has gone through three releases. Therefore users had time to upgrade their own environments to contain a version which does not have this dependency problem.

If you have not seen this type of a problem before, then you can consider yourself lucky. In practice there are three ways to mitigate the problem

1) Build your Python and dependencies once as package and reuse it many times. Docker, podman, vagrant are typical solutions in this area. In this case you select when package is built and control when updating is done.

2) install every time, but let versions float. In this solution you don’t control your libraries and it dependencies. Instead one have system which allows to rebuild and deploy the desired libraries and dependencies on demand. In this approach you will easily spot the failures and can easily fix the problem too. Example using dynamically allocated containers, virtual machines (whatever) from could is typical use case for this approach

3) You do both of the above. Which is the most recommended way in my opinion.

You should see this as a learning opportunity, because similar situations will also happen in future. It can happen with any library and dependencies it has. It’s up to you to decide how prepared you are next time?

aliasgerkw commented 10 months ago

Hey @aaltat

I upgraded my docker image to have python version 3.9 (node version v12.22.12) and also upgraded robotframework-browser 18.0.0 but was still facing the error

19:01:25  + rfbrowser init
19:01:26  Traceback (most recent call last):
19:01:26    File "/home/pwuser/.local/bin/rfbrowser", line 5, in <module>
19:01:26      from Browser.entry import run
19:01:26  ImportError: cannot import name 'run' from 'Browser.entry' (/usr/local/lib/python3.9/dist-packages/Browser/entry.py)

following the thread I reduced robotframework-assertion-engine to 2.0.0 from 3.0.0 but after that getting

19:01:24  ERROR: robotframework-browser 18.0.0 has requirement robotframework-assertion-engine<4.0.0,>=3.0.3, but you'll have robotframework-assertion-engine 2.0.0 which is incompatible.

and build is failing with

19:01:25  + getconf _NPROCESSORS_ONLN
19:01:25  8
19:01:25  + rfbrowser init
19:01:26  Traceback (most recent call last):
19:01:26    File "/home/pwuser/.local/bin/rfbrowser", line 5, in <module>
19:01:26      from Browser.entry import run
19:01:26  ImportError: cannot import name 'run' from 'Browser.entry' (/usr/local/lib/python3.9/dist-packages/Browser/entry.py)

Any suggestions are highly appriciated.