Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete fix in issue #9678 #9818

Closed
JohnA2 opened this issue Sep 13, 2021 · 5 comments
Closed

Incomplete fix in issue #9678 #9818

JohnA2 opened this issue Sep 13, 2021 · 5 comments
Labels

Comments

@JohnA2
Copy link

JohnA2 commented Sep 13, 2021

馃挜 Regression Report

I described two types of warnings in #9678, but it was closed after only one of them was fixed. I tested the commit shortly after it was done and left a comment where I mentioned it. It's been more than a month since the comment and that issue was "automatically locked since there has not been any recent activity after it was closed", so I have to open a new one. Now I also tested rc1 and can confirm that the second warning is still not fixed.

Last working Selenium version

Worked up to version: 3.141.0

Stopped working in version: 4.x

To Reproduce

See #9678

Expected behavior

See #9678

Test script reproducing this issue (when applicable)

See #9678

Environment

OS: any
Browser: Firefox and Internet Explorer
Browser version: any
Browser Driver version: latest
Language Bindings version: Python 4.0.0rc1
Selenium Grid version (if applicable): N/A

@ghost ghost added the needs-triaging label Sep 13, 2021
@JohnA2
Copy link
Author

JohnA2 commented Oct 4, 2021

Still the same issue in 4.0.0rc2.

Also the fix in #9678 breaks IE if it's initialized with options. If I do just

driver = Ie()

it still works (with the warning). But the below code fails.

options = IeOptions()
driver = Ie(options=options)

@AutomatedTester
Copy link
Member

@JohnA2 I don't have a machine to test with IE, could you submit a PR or tell me if the following diff is sufficient?

diff --git a/py/selenium/webdriver/ie/webdriver.py b/py/selenium/webdriver/ie/webdriver.py
index 6821048118..c1e8f3e75e 100644
--- a/py/selenium/webdriver/ie/webdriver.py
+++ b/py/selenium/webdriver/ie/webdriver.py
@@ -28,7 +28,7 @@ DEFAULT_PORT = 0
 DEFAULT_HOST = None
 DEFAULT_LOG_LEVEL = None
 DEFAULT_SERVICE_LOG_PATH = None
-DEFAULT_KEEP_ALIVE = None
+DEFAULT_KEEP_ALIVE = True
 
 
 class WebDriver(RemoteWebDriver):
@@ -61,7 +61,7 @@ class WebDriver(RemoteWebDriver):
                           DeprecationWarning, stacklevel=2)
         if capabilities:
             warnings.warn('capabilities has been deprecated, please pass in an Options object.'
-                          'This field will be ignored if an Options object is also used.',
+                          'This field will be ignored.',
                           DeprecationWarning, stacklevel=2)
         if port != DEFAULT_PORT:
             warnings.warn('port has been deprecated, please pass in a Service object',
@@ -79,7 +79,8 @@ class WebDriver(RemoteWebDriver):
             warnings.warn('service_log_path has been deprecated, please pass in a Service object',
                           DeprecationWarning, stacklevel=2)
         if desired_capabilities:
-            warnings.warn('desired_capabilities has been deprecated, please pass in an Options object',
+            warnings.warn('desired_capabilities has been deprecated, please pass in an Options object.'
+                          'This field will be ignored',
                           DeprecationWarning, stacklevel=2)
         if keep_alive != DEFAULT_KEEP_ALIVE:
             warnings.warn('keep_alive has been deprecated, please pass in a Service object',
@@ -92,19 +93,9 @@ class WebDriver(RemoteWebDriver):
         if self.port == 0:
             self.port = utils.free_port()
 
-        # If both capabilities and desired capabilities are set, ignore desired capabilities.
-        if not capabilities and desired_capabilities:
-            capabilities = desired_capabilities
-
         if not options:
-            if not capabilities:
-                capabilities = self.create_options().to_capabilities()
-        else:
-            if not capabilities:
-                capabilities = options.to_capabilities()
-            else:
-                # desired_capabilities stays as passed in
-                capabilities.update(options.to_capabilities())
+            options = self.create_options()
+
         if service:
             self.iedriver = service
         else:

@JohnA2
Copy link
Author

JohnA2 commented Oct 8, 2021

@AutomatedTester Thanks for looking into it. The warning is still not fixed with your changes. But if I revert DEFAULT_KEEP_ALIVE = True to DEFAULT_KEEP_ALIVE = None and change

        if keep_alive != DEFAULT_KEEP_ALIVE:
            ...
        else:
            keep_alive = False

to

        if keep_alive != DEFAULT_KEEP_ALIVE:
            ...
        else:
            keep_alive = True

instead (similarly to how it's done in https://github.com/SeleniumHQ/selenium/blob/trunk/py/selenium/webdriver/chrome/webdriver.py ), the warning goes away.

Also I forgot to mention in my previous comment that the error when using IeOptions is "Unable to match capability set 0: platformName must be 'windows', but was 'WINDOWS'". So the fix for this one is to change "WINDOWS" to "windows" in https://github.com/SeleniumHQ/selenium/blob/trunk/py/selenium/webdriver/common/desired_capabilities.py

@JohnA2
Copy link
Author

JohnA2 commented Oct 8, 2021

Everything works great with your commit. Thanks!

@github-actions
Copy link

github-actions bot commented Nov 8, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants