robotframework / SeleniumLibrary

Web testing library for Robot Framework
Apache License 2.0
1.37k stars 752 forks source link

TypeError: WebDriver.__init__() got an unexpected keyword argument 'service_log_path' #1835

Closed LLinden closed 11 months ago

LLinden commented 1 year ago

Hi,

When I try to run a robot test I'm getting the following error:

TypeError: WebDriver.__init__() got an unexpected keyword argument 'service_log_path'

Similar to this resolved issue: https://github.com/robotframework/SeleniumLibrary/issues/1419

Although I'm using Chrome and I've already using the latest versions of SeleniumLibarary, Chromedriver and Robot.

python --version Python 3.11.4

robot --version Robot Framework 6.0.2 (Python 3.11.4 on win32)

chromedriver --version ChromeDriver 114.0.5735.90

I've installed SeleniumLibary today via pip install --upgrade robotframework-seleniumlibrary

Chrome version: 114.0.5735.110 64 bits

The project that I'm using is this: https://gitlab.com/bftft/robot-framework-testautomationu-2022/-/tree/main/

An exemple of test that I'm trying to run is this: https://gitlab.com/bftft/robot-framework-testautomationu-2022/-/tree/main/005-TestCases

first-test-case.ansewer.robot

I appreciate any help.

Meem12 commented 12 months ago

hi guys I been using RObot framework for few days . I ah ve created script and that's running fine but i have to create a new script but in that I'm just unbale to launch the browser getting this erroro : TypeError: WebDriver.init() got an unexpected keyword argument 'service_log_path'. I download Selenium to 4.9.0 but still the same issue, I really need to create this new script , can some one plz help

emanlove commented 12 months ago

@Meem12 If you are getting this error it means which ever Python is executing the script has Selenium v4.10.0 installed. If you are using a IDE with extensions you will need to configure either the Python or the Packages it installs.

Meem12 commented 12 months ago

Thanks for the reply. I have another previous project script which is running fine. I'm using Mycharm IDE. with Python version 3.11.3 and selenium i installed 4.10.0 I even tried downgrade selenium to 09 from command prompt but it didn't work for my new project script. Could you elaborate a bit about this configuration thing

On Mon, Jul 31, 2023 at 9:28 AM Ed Manlove @.***> wrote:

@Meem12 https://github.com/Meem12 If you are getting this error it means which ever Python is executing the script has Selenium v4.10.0 installed. If you are using a IDE with extensions you will need to configure either the Python or the Packages it installs.

— Reply to this email directly, view it on GitHub https://github.com/robotframework/SeleniumLibrary/issues/1835#issuecomment-1658374212, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBTU2HE3BR43B5S6KVZMYBTXS6XJBANCNFSM6AAAAAAY6IVZEY . You are receiving this because you were mentioned.Message ID: @.***>

emanlove commented 12 months ago

A release candidate v6.1.1rc1 has been pushed to PyPI which is intended to resolve this issue. If you have pip installed, just run

pip install --pre --upgrade robotframework-seleniumlibrary

to install this release candidate or as I prefer use

pip install robotframework-seleniumlibrary==6.1.1rc1

to install exactly this version. The changes are all internal and very subtle. I recommend people do some check under certain conditions to verify this is working for you as it did previously based upon how you use the Open Browser keyword. Notes about this are in the release notes for v6.1.1rc1 and can be found at https://github.com/robotframework/SeleniumLibrary/blob/master/docs/SeleniumLibrary-6.1.1rc1.rst

Please read through these thoroughly and follow the recommended verification steps before one comments. Thank you.

Meem12 commented 11 months ago

Thanks a lot Manlove! I ran my previous script to finish up this sprint at work. I'm little scared to do this upgrade command in case this would also start failing my previous script LOL. then I'd be just doomed

On Wed, Aug 2, 2023 at 12:09 AM Ed Manlove @.***> wrote:

A release candidate v6.1.1rc1 has been pushed to PyPI which is intended to resolve this issue. If you have pip installed, just run

pip install --pre --upgrade robotframework-seleniumlibrary

to install this release candidate or as I prefer use

pip install robotframework-seleniumlibrary==6.1.1rc1

to install exactly this version. The changes are all internal and very subtle. I recommend people do some check under certain conditions to verify this is working for you as it did previously based upon how you use the Open Browser keyword. Notes about this are in the release notes for v6.1.1rc1 and can be found at https://github.com/robotframework/SeleniumLibrary/blob/master/docs/SeleniumLibrary-6.1.1rc1.rst

Please read through these thoroughly and follow the recommended verification steps before one comments. Thank you.

— Reply to this email directly, view it on GitHub https://github.com/robotframework/SeleniumLibrary/issues/1835#issuecomment-1661460370, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBTU2HA74FTGXOUOPOR3Y2TXTHHGTANCNFSM6AAAAAAY6IVZEY . You are receiving this because you were mentioned.Message ID: @.***>

emanlove commented 11 months ago

This has been fixed in the SeleniumLibrary v6.1.1 release.

Meem12 commented 11 months ago

Thank you so much for your time for looking into this matter. Appreciated it !!

On Fri, Aug 4, 2023 at 9:56 AM Ed Manlove @.***> wrote:

This has been fixed in the SeleniumLibrary v6.1.1 release.

— Reply to this email directly, view it on GitHub https://github.com/robotframework/SeleniumLibrary/issues/1835#issuecomment-1665652140, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBTU2HGX5PFLJMF47ZZF5W3XTT5SFANCNFSM6AAAAAAY6IVZEY . You are receiving this because you were mentioned.Message ID: @.***>

perlun commented 11 months ago

For reference, this is the issue I was looking for when debugging this. :sweat_smile: I googled but I must have been doing a too bad job. (I even see now that it's one the very first page of the Google search results, and I might even have opened it, but I think that the fact that this referred to service_log_path instead of firefox_profile didn't catch my attention well enough. :neutral_face:)

Anyway, here's the error I was seeing: WebDriver.__init__() got an unexpected keyword argument 'firefox_profile'. Adding more logging to the Robot test runner with --loglevel DEBUG --debugfile output.log gave me this in the output.log file:

==============================================================================
20230822 08:33:58.107 - INFO - + START SUITE: TestSuite [ ]
==============================================================================
20230822 08:33:58.169 - INFO - +- START SUITE: TestSuite.Assign To Room [ ]
==============================================================================
20230822 08:33:58.170 - INFO - +-- START TEST: Open Keyboard in RoomSelector [ ]
------------------------------------------------------------------------------
20230822 08:33:58.170 - INFO - +--- START KEYWORD: Hotel_Keywords.Open RoomSelector [ ${deviceSerial} ]
20230822 08:33:58.170 - INFO - +---- START KEYWORD: SeleniumLibrary.Open Browser [ ${URL}/path?ke=value1&key2=${value2} | ${Browser} ]
20230822 08:33:58.170 - INFO - Opening browser 'Firefox' to base url 'http://dind:32784/app/path?key1=value1&key2=value2.
20230822 08:33:58.171 - INFO - Firefox driver log is always forced to to: /path/to/output/geckodriver-1.log
20230822 08:33:58.171 - INFO - Cannot capture screenshot because no browser is open.
20230822 08:33:58.171 - FAIL - TypeError: WebDriver.__init__() got an unexpected keyword argument 'firefox_profile'
20230822 08:33:58.171 - DEBUG - Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/SeleniumLibrary/__init__.py", line 496, in run_keyword
    return DynamicCore.run_keyword(self, name, args, kwargs)
  File "/usr/local/lib/python3.10/dist-packages/robotlibcore.py", line 126, in run_keyword
    return self.keywords[name](*args, **(kwargs or {}))
  File "/usr/local/lib/python3.10/dist-packages/SeleniumLibrary/keywords/browsermanagement.py", line 293, in open_browser
    return self._make_new_browser(
  File "/usr/local/lib/python3.10/dist-packages/SeleniumLibrary/keywords/browsermanagement.py", line 324, in _make_new_browser
    driver = self._make_driver(
  File "/usr/local/lib/python3.10/dist-packages/SeleniumLibrary/keywords/browsermanagement.py", line 716, in _make_driver
    driver = self._webdriver_creator.create_driver(
  File "/usr/local/lib/python3.10/dist-packages/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py", line 83, in create_driver
    return creation_method(
  File "/usr/local/lib/python3.10/dist-packages/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py", line 199, in create_firefox
    return webdriver.Firefox(
TypeError: WebDriver.__init__() got an unexpected keyword argument 'firefox_profile'
20230822 08:33:58.171 - INFO - +---- END KEYWORD: SeleniumLibrary.Open Browser (1)
20230822 08:33:58.171 - INFO - +---- START KEYWORD: SeleniumLibrary.Set Window Size [ 1920 | 1080 ]
20230822 08:33:58.171 - INFO - +---- END KEYWORD: SeleniumLibrary.Set Window Size (0)
20230822 08:33:58.171 - INFO - +---- START KEYWORD: SeleniumLibrary.Wait Until Page Contains [ <something> | 10s ]
20230822 08:33:58.171 - INFO - +---- END KEYWORD: SeleniumLibrary.Wait Until Page Contains (0)
20230822 08:33:58.171 - INFO - +--- END KEYWORD: Hotel_Keywords.Open RoomSelector (1)

The fix in this case is one of the following:

I feel silly about having spent so much time on this, but here goes. Maybe this will help someone else out there. Take care. :+1:

nra-Dvg commented 8 months ago

I also faced the same issue after upgrading the robot framework & some robo libraries. after I downgraded selenium & robotframework-seleniumlibrary. now it's working fine for me.

used selenium==4.1.3 & robotframework-seleniumlibrary 6.0.0 & robotframework 5.0.1

emanlove commented 8 months ago

@nra-Dvg A few questions .. which issue in particular (as people have listed a few here)? And upgrading to which SeleniumLibrary, Selenium and Robot Framework versions?