You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the recent removal of the Opera references I noticed some discrepancies and some things that just didn't look right within this code. I want to review that code now there are some significant changes. This is a placeholder reminder.
Another item we should check is the parameters for creating webdriver. I see an additional parameter service on the Chrome and Chromium WebDriver classes that I am not sure we are either describing (very likely) or passing along (I think unlikely).
raiseRuntimeError(f"'{driver_name}' is not a valid WebDriver name.")
self.info(f"Creating an instance of the {driver_name} WebDriver.")
driver=creation_func(**init_kwargs)
self.debug(
creation_func should return the browser specific webdriver class (instantiated in line 391), but all it returns is the module <module 'selenium.webdriver.chromium'>:
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'module' object is not callable
(its __init__.py is empty, no code runs)
However, while debugging, when I am assigning the Chromium Webdriver class by hand, creation_func starts the browser:
# (halted in line 391)
from selenium.webdriver.chrome.webdriver import WebDriver
creation_func = WebDriver
creation_func(**init_kwargs)
# (chromium starts successfully)
<selenium.webdriver.chrome.webdriver.WebDriver (session="62a68ae2a4b6687ae0f76df8cc45883e")>
I am far from being able to judge whether my approach is correct or to decide what exactly is the error.
But yes, there is something broken (but you already knew that before ;-) )
I wasn't aware of an issue this in depth. I just know that some recent changes in both Selenium and SeleniumLibrary around supported browsers and the underlying Open Browser keyword/functionality threw up red flags in my mind. So I wanted a full review. Thanks for this report!
That looks like a usability bug to me. So I think it still counts!
One of those robot improvements that's on my list would be situations like these where either a warning is given if it looks like someone has an invalid argument name. For example, Log console_msg=ed_was_here might result in Warning: Did you mean to use "console" argument instead of "console_msg" .. or something similar. There could also be the case you share where it is very close.
Activity
emanlove commentedon Oct 5, 2022
Also review for phantomJS, Andriod, and iPhone references as well
emanlove commentedon Oct 23, 2022
Another item we should check is the parameters for creating webdriver. I see an additional parameter
serviceon the Chrome and Chromium WebDriver classes that I am not sure we are either describing (very likely) or passing along (I think unlikely).simonmeggle commentedon Dec 21, 2022
Hi Ed, I also notice that creating a webdriver does not work as expected (Selenium 4.7.2, SeleniumLibrary 6.0.0).
calls
browsermanagement > BrowserManagementKeywords > create_webdriverSeleniumLibrary/src/SeleniumLibrary/keywords/browsermanagement.py
Lines 383 to 390 in 24c732b
creation_funcshould return the browser specific webdriver class (instantiated in line 391), but all it returns is the module <module 'selenium.webdriver.chromium'>:(its
__init__.pyis empty, no code runs)However, while debugging, when I am assigning the Chromium Webdriver class by hand,
creation_funcstarts the browser:I am far from being able to judge whether my approach is correct or to decide what exactly is the error.
But yes, there is something broken (but you already knew that before ;-) )
emanlove commentedon Dec 21, 2022
I wasn't aware of an issue this in depth. I just know that some recent changes in both Selenium and SeleniumLibrary around supported browsers and the underlying Open Browser keyword/functionality threw up red flags in my mind. So I wanted a full review. Thanks for this report!
simonmeggle commentedon Dec 21, 2022
OMG. Wrong path... 🤦♂️
It makes a big difference how you write the browser name.
SeleniumLibrary/src/SeleniumLibrary/keywords/browsermanagement.py
Line 385 in 24c732b
In case of "Chrome" it returns the webdriver object.
But "chrome" is also an attribute of this module and returns the submodule (totally wrong).
Maybe the first letter of
driver_nameshould be forced to a capital letter before reading the attrs, so that "chrome" is also a valid argument?(EDIT: Sorry, has nothing to do with the actual problem now. )
emanlove commentedon Dec 21, 2022
That looks like a usability bug to me. So I think it still counts!
One of those robot improvements that's on my list would be situations like these where either a warning is given if it looks like someone has an invalid argument name. For example,
Log console_msg=ed_was_heremight result inWarning: Did you mean to use "console" argument instead of "console_msg".. or something similar. There could also be the case you share where it is very close.