Skip to content

Commit f1ba358

Browse files
committed
Invoke console scripts with "python -m seleniumbase"
1 parent dd54fd3 commit f1ba358

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

seleniumbase/__main__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import os
2+
import sys
3+
4+
# Remove "" and current working directory from the first entry
5+
# of sys.path (if present) to avoid using the current directory
6+
# in SeleniumBase commands when invoked as "python -m seleniumbase <command>"
7+
if sys.path[0] in ("", os.getcwd()):
8+
sys.path.pop(0)
9+
10+
if __package__ == "":
11+
path = os.path.dirname(os.path.dirname(__file__))
12+
sys.path.insert(0, path)
13+
14+
if __name__ == "__main__":
15+
import warnings
16+
from seleniumbase.console_scripts.run import main
17+
18+
warnings.filterwarnings(
19+
"ignore", category=DeprecationWarning, module=".*packaging\\.version"
20+
)
21+
main()
22+
sys.exit()

0 commit comments

Comments
 (0)