-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
selenium >= 4.3.0 | ||
robotframework >= 4.1.3 | ||
robotframework-pythonlibcore >= 3.0.0 | ||
robotframework-pythonlibcore >= 4.4.1 | ||
click >= 8.1.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2008-2011 Nokia Networks | ||
# Copyright 2011-2016 Ryan Tomac, Ed Manlove and contributors | ||
# Copyright 2016- Robot Framework Foundation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2008-2011 Nokia Networks | ||
# Copyright 2011-2016 Ryan Tomac, Ed Manlove and contributors | ||
# Copyright 2016- Robot Framework Foundation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import click | ||
|
||
from print_version import print_version | ||
|
||
CONTEXT_SETTINGS = {"help_option_names": ["-h", "--help"]} | ||
|
||
|
||
@click.group( | ||
invoke_without_command=True, context_settings=CONTEXT_SETTINGS, no_args_is_help=True | ||
) | ||
@click.option( | ||
"--version", | ||
is_flag=True, | ||
help="Prints versions and exits", | ||
callback=print_version, | ||
expose_value=False, | ||
is_eager=True, | ||
) | ||
def cli(): | ||
"""Robot Framework SeleniumLibrary command line tool. | ||
Possible commands are: | ||
translation | ||
translation will generate detaul tranlsation json file from library keywords. | ||
See each command argument help for more details what (optional) arguments that command supports. | ||
""" | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright 2008-2011 Nokia Networks | ||
# Copyright 2011-2016 Ryan Tomac, Ed Manlove and contributors | ||
# Copyright 2016- Robot Framework Foundation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
from pathlib import Path | ||
import re | ||
import subprocess | ||
import sys | ||
|
||
from selenium import __version__ | ||
|
||
INSTALL_DIR = Path(__file__).parent.parent | ||
|
||
|
||
def get_rf_version() -> str: | ||
process = subprocess.run( | ||
[sys.executable, "-m", "robot", "--version"], capture_output=True, check=False | ||
) | ||
return process.stdout.decode("utf-8").split(" ")[2] | ||
|
||
|
||
def get_library_version() -> str: | ||
init_file = INSTALL_DIR / "__init__.py" | ||
with init_file.open("r") as file: | ||
data = file.read() | ||
return re.search('\n__version__ = "(.*)"', data).group(1) | ||
|
||
|
||
def print_version(ctx, param, value): | ||
"""Display Python, Robot Framework, SeleniumLibrary and selenium versions""" | ||
python_version = ( | ||
f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}" | ||
) | ||
print(f"Used Python is: {sys.executable}\nVersion: {python_version}") | ||
print(f'Robot Framework version: "{get_rf_version()}"') | ||
print(f"Installed SeleniumLibrary version is: {get_library_version()}") | ||
print(f"Installed selenium version is: {__version__}") |