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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes SeleniumLibrary Firefox profile #885

Merged
merged 7 commits into from
Sep 6, 2017

Conversation

aaltat
Copy link
Contributor

@aaltat aaltat commented Sep 2, 2017

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

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
Copy link
Member

@pekkaklarck pekkaklarck left a 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
Copy link
Member

@pekkaklarck pekkaklarck Sep 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It took me a little time to make sure RobotNotRunningError cannot occur when querying ${OUTPUTDIR}. I think the code should be reorganized a little.
  2. 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.
  3. os.getcwd() returns bytes on Python 2. This causes problems if the path contains non-ASCII characters. Should either use os.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()

Copy link
Contributor Author

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])
Copy link
Member

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:
    major, minor, micro = (selenium.__version__.split('.') + ['0', '0'])[:3]
    SELENIUM_VERSION = SeleniumVersion(major, minor, micro)
    If earlier releases have always contained three components, the above is an overkill.

Copy link
Contributor Author

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.

@aaltat aaltat merged commit 091e359 into robotframework:master Sep 6, 2017
@aaltat aaltat deleted the use_selenium_ff_profile branch September 8, 2017 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants