robotframework / SeleniumLibrary

Web testing library for Robot Framework
Apache License 2.0
1.4k stars 765 forks source link

After upgrade from 4.5.0, cannot use SeleniumLibrary. Fails with error: TypeError: HybridCore.__init__() takes 2 positional arguments but 3 were given #1920

Open HelioGuilherme66 opened 2 months ago

HelioGuilherme66 commented 2 months ago

Steps to reproduce the issue

Initial problem was found in Python 3.9, with upgrade from 4.5.0 to 6.1.1, and still happens in 6.6.1, also in Python 3.12.6. After downgrade to 4.5.0 in Python 3.12.6, test suite runs as expected.

On both IDEs, Visual Studio Code with Robotcode, and RIDE v2.1b1, the library is marked as failed to import documentation.

Simple test case:

*** Settings ***
Documentation   Suite description
Library         SeleniumLibrary

*** Test Cases ***
demo
  [Tags]  demo
  Open Browser  https://robotframework.org  chrome
  Sleep  3 seconds
  Capture Page Screenshot
  [Teardown]  close all browsers

Error messages and additional information

Output of test run (test suite with resources):

[ ERROR ] Error in file 'C:\Sander\GitHub\ronaldvandermolen\RFW\Experimental_Rinya\Mantis\Resources\Common\Common.robot' on line 3: Initializing library 'SeleniumLibrary' with no arguments failed: TypeError: HybridCore.__init__() takes 2 positional arguments but 3 were given
Traceback (most recent call last):
  File "C:\Sander\Python\Lib\site-packages\SeleniumLibrary\__init__.py", line 673, in __init__
    DynamicCore.__init__(self, libraries, translation_file)
TypeError: HybridCore.__init__() takes 2 positional arguments but 3 were given
[ ERROR ] Error in file 'C:\Sander\GitHub\ronaldvandermolen\RFW\Experimental_Rinya\Mantis\Resources\MantisKeywords\MantisKeywords.robot' on line 3: Initializing library 'SeleniumLibrary' with no arguments failed: TypeError: HybridCore.__init__() takes 2 positional arguments but 3 were given
Traceback (most recent call last):
  File "C:\Sander\Python\Lib\site-packages\SeleniumLibrary\__init__.py", line 673, in __init__
    DynamicCore.__init__(self, libraries, translation_file)
TypeError: HybridCore.__init__() takes 2 positional arguments but 3 were given

(I open this on behalf of user) Initial conversation happened in Slack #seleniumlibrary channel.

Expected behavior and actual behavior

Expected no errors and documentation loaded in IDEs and test run to proceed.

Environment

Browser: Chrome Browser driver: chromedriver Operating System: Windows 11 x64 Libraries

emanlove commented 2 months ago

Hélio, does the error occur with the latest version of Selenium v4.25.0?

To me this is important as there is some version compatibility issues here. SeleniumLibrary only with the 6.6.1 release "officially" supported Python v3.12.x. And even there in that release we noted the Robot Framework v7.1 had not been released but we did test against 7.1rc2. But v6.6.1 suports only back to Selenium v4.21.0. (And only that far back because we weren;'t constantly testing/releasing each month during the summer as the most recent selenium version came out. Our goal is to support that last two seleniums).

So going back to either Selenium 4.16.0 or SeleniumLibrary 6.1.1 would be incompatable with Robot Framework 7.1 and Python 3.12.

HelioGuilherme66 commented 2 months ago

@emanlove User says Selenium is 4.25.0. I'll edit version.

(I did upgrade on may machine too, but no problems. Maybe still some cache.):

No problems on my machine, after completely reinstall of SeleniumLibrary.

HelioGuilherme66 commented 2 months ago

User reports that:

robotframework-seleniumlibrary 6.3.0. works fine.

avnik commented 1 month ago

Updating pythonlibcore to 4.4.1 fix issue

HelioGuilherme66 commented 1 month ago

@avnik User reports that upgrading pythollibcore did not solve issue:

Below the list of my pip list:

Package                        Version
------------------------------ -----------
Appium-Python-Client           3.1.0
attrs                          24.2.0
certifi                        2024.8.30
cffi                           1.17.1
charset-normalizer             3.3.2
click                          8.1.7
colorama                       0.4.6
decorator                      5.1.1
docutils                       0.20.1
enum34                         1.1.6
et-xmlfile                     1.1.0
exceptiongroup                 1.2.2
future                         0.18.3
h11                            0.14.0
idna                           3.10
jdcal                          1.4.1
Jinja2                         3.1.4
jsonpath-ng                    1.6.0
jsonschema                     4.20.0
jsonschema-specifications      2023.11.1
kitchen                        1.2.6
markdown-it-py                 3.0.0
MarkupSafe                     2.1.3
mdurl                          0.1.2
natsort                        5.2.0
numpy                          1.26.2
openpyxl                       2.5.1
outcome                        1.3.0.post0
packaging                      24.1
pathspec                       0.11.2
Pillow                         10.1.0
pip                            24.2
ply                            3.11
prompt-toolkit                 2.0.10
psutil                         6.0.0
pycparser                      2.22
Pygments                       2.18.0
PyNaCl                         1.5.0
Pypubsub                       4.0.3
PySocks                        1.7.1
pywin32                        306
questionary                    2.0.1
referencing                    0.31.0
requests                       2.31.0
rich                           13.7.0
rich-click                     1.6.1
robotframework                 7.1
robotframework-appiumlibrary   2.0.0
robotframework-crypto          0.3.0
robotframework-databaselibrary 1.4.1
robotframework-debuglibrary    2.3.0
robotframework-excel           1.0.0b4
robotframework-excellib        2.0.1
robotframework-imaplibrary     0.3.0
robotframework-jsonlibrary     0.5
robotframework-pythonlibcore   4.4.1
robotframework-requests        0.9.6
robotframework-ride            2.1b1
robotframework-seleniumlibrary 6.6.1
robotframework-tidy            4.14.0
robotframework-timer           0.0.6
robotlibcore-temp              1.0.2
rpds-py                        0.13.1
selenium                       4.25.0
setuptools                     75.1.0
six                            1.16.0
sniffio                        1.3.1
sortedcontainers               2.4.0
tomli                          2.0.1
trio                           0.26.2
trio-websocket                 0.11.1
typing_extensions              4.12.2
urllib3                        2.2.3
wcwidth                        0.2.12
websocket-client               1.8.0
wsproto                        1.2.0
wxPython                       4.2.2
xlrd                           2.0.1
xlutils                        2.0.0
xlwt                           1.3.0
avnik commented 4 weeks ago

@HelioGuilherme66 https://github.com/avnik/ghaf-ci-test-automation/blob/avnik/selenium/pkgs/robotframework-seleniumlibrary/default.nix package with robotframework-pythonlibcore from nixpkgs 24.05 works for me. Never tried to install in raw pip environment.