111111from seleniumbase .fixtures import constants
112112from seleniumbase .fixtures import shared_utils
113113
114+ is_linux = shared_utils .is_linux ()
115+ is_windows = shared_utils .is_windows ()
114116sb_config .__base_class = None
115117
116118
@@ -829,10 +831,10 @@ def get_configured_sb(context):
829831 '\n (Your browser choice was: "%s")\n ' % sb .browser
830832 )
831833 # The Xvfb virtual display server is for Linux OS Only.
832- if sb .xvfb and not shared_utils . is_linux () :
834+ if sb .xvfb and not is_linux :
833835 sb .xvfb = False
834836 if (
835- shared_utils . is_linux ()
837+ is_linux
836838 and not sb .headed
837839 and not sb .headless
838840 and not sb .headless2
@@ -1020,7 +1022,7 @@ def dashboard_pre_processing():
10201022 filename = None
10211023 feature_name = None
10221024 scenario_name = None
1023- if shared_utils . is_windows () :
1025+ if is_windows :
10241026 output = output .decode ("latin1" )
10251027 else :
10261028 output = output .decode ("utf-8" )
@@ -1129,8 +1131,11 @@ def behave_dashboard_prepare():
11291131 stars = "*" * star_len
11301132 c1 = ""
11311133 cr = ""
1132- if not shared_utils .is_linux ():
1133- colorama .init (autoreset = True )
1134+ if not is_linux :
1135+ if is_windows and hasattr (colorama , "just_fix_windows_console" ):
1136+ colorama .just_fix_windows_console ()
1137+ else :
1138+ colorama .init (autoreset = True )
11341139 c1 = colorama .Fore .BLUE + colorama .Back .LIGHTCYAN_EX
11351140 cr = colorama .Style .RESET_ALL
11361141 print ("Dashboard: %s%s%s\n %s" % (c1 , dash_path , cr , stars ))
@@ -1144,7 +1149,7 @@ def _perform_behave_unconfigure_():
11441149 if sb_config .shared_driver :
11451150 try :
11461151 if (
1147- not shared_utils . is_windows ()
1152+ not is_windows
11481153 or sb_config .browser == "ie"
11491154 or sb_config .shared_driver .service .process
11501155 ):
@@ -1221,7 +1226,7 @@ def do_final_driver_cleanup_as_needed():
12211226 try :
12221227 if hasattr (sb_config , "last_driver" ) and sb_config .last_driver :
12231228 if (
1224- not shared_utils . is_windows ()
1229+ not is_windows
12251230 or sb_config .browser == "ie"
12261231 or sb_config .last_driver .service .process
12271232 ):
@@ -1245,8 +1250,11 @@ def _perform_behave_terminal_summary_():
12451250 equals = "=" * (equals_len + 2 )
12461251 c2 = ""
12471252 cr = ""
1248- if not shared_utils .is_linux ():
1249- colorama .init (autoreset = True )
1253+ if not is_linux :
1254+ if is_windows and hasattr (colorama , "just_fix_windows_console" ):
1255+ colorama .just_fix_windows_console ()
1256+ else :
1257+ colorama .init (autoreset = True )
12501258 c2 = colorama .Fore .MAGENTA + colorama .Back .LIGHTYELLOW_EX
12511259 cr = colorama .Style .RESET_ALL
12521260 if sb_config .dashboard :
0 commit comments