-
Notifications
You must be signed in to change notification settings - Fork 763
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removes SeleniumLibrary Firefox profile #885
Conversation
The SeleniumLibrary default Firefox profile is now removed. When Firefox created and if Firefox profile is not defined, then the default Selenium FirefoxProfile is used. Fixes robotframework#883
99f0729
to
5e8bad3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Please take a look at the line notes, though.
logdir = os.path.dirname(logfile) | ||
else: | ||
logdir = BuiltIn().get_variable_value('${OUTPUTDIR}') | ||
return logdir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It took me a little time to make sure
RobotNotRunningError
cannot occur when querying${OUTPUTDIR}
. I think the code should be reorganized a little. - There seems to be a logic bug when you actually get that
RobotNotRunningError
. The returned directory seems to be the parent directory of the cwd in that case. os.getcwd()
returns bytes on Python 2. This causes problems if the path contains non-ASCII characters. Should either useos.getcwdu()
(which doesn't exist on Python 3) or just return'.'
.
Perhaps the code could be something like this:
try:
logfile = BuiltIn().get_variable_value('${LOG FILE}')
if logfile == 'NONE':
return BuiltIn().get_variable_value('${OUTPUTDIR}')
return os.path.dirname(logfile)
except RobotNotRunningError:
return os.getcwd() if PY3 else os.getcwdu()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed and done.
SeleniumVersion = namedtuple('SeleniumVersion', 'major minor micro') | ||
version = selenium.__version__.split('.') | ||
selenium_version = SeleniumVersion(major=version[0], minor=version[1], | ||
micro=version[2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Copyrights missing from the file.
- +1 for namedtuple.
- Like you commented elsewhere, SELENIUM_VERSION is better name for the constant.
- Can we be certain that version always has three components? If not, this could be used:
If earlier releases have always contained three components, the above is an overkill.
major, minor, micro = (selenium.__version__.split('.') + ['0', '0'])[:3] SELENIUM_VERSION = SeleniumVersion(major, minor, micro)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked releases all to they to the 2.50.0 and there always has been three components, in the version field. But in one day, there might not be, so why risk it.
Others done.
The SeleniumLibrary default Firefox profile is now removed. When
Firefox created and if Firefox profile is not defined, then the
default Selenium FirefoxProfile is used.
Fixes #883