11""" SeleniumBase Verification """
2+ import sys
3+
4+ headless = "--headless"
5+ if "win32" in sys .platform :
6+ headless = "--chs"
7+
28if __name__ == "__main__" :
39 from pytest import main
410 main ([__file__ , "-v" , "-s" ])
@@ -19,7 +25,7 @@ def test_failing(self):
1925 self.assert_equal('yes', 'no')
2026 """
2127 )
22- result = pytester .inline_run ("-- headless" , "--rs" , "-v" )
28+ result = pytester .inline_run (headless , "--rs" , "-v" )
2329 assert result .matchreport ("test_passing" ).passed
2430 assert result .matchreport ("test_failing" ).skipped
2531
@@ -37,7 +43,7 @@ def test_basecase(self):
3743 self.click("body p") # selector
3844 """
3945 )
40- result = pytester .inline_run ("-- headless" , "-v" )
46+ result = pytester .inline_run (headless , "-v" )
4147 assert result .matchreport ("test_basecase" ).passed
4248
4349
@@ -54,7 +60,7 @@ def test_3_skipped(self):
5460 self.skip("Skip!")
5561 """
5662 )
57- result = pytester .inline_run ("-- headless" , "--rs" , "--dashboard" , "-v" )
63+ result = pytester .inline_run (headless , "--rs" , "--dashboard" , "-v" )
5864 assert result .matchreport ("test_1_passing" ).passed
5965 assert result .matchreport ("test_2_failing" ).failed
6066 assert result .matchreport ("test_3_skipped" ).skipped
@@ -71,7 +77,7 @@ def test_sb_fixture(sb):
7177 sb.click("body p") # selector
7278 """
7379 )
74- result = pytester .inline_run ("-- headless" , "-v" )
80+ result = pytester .inline_run (headless , "-v" )
7581 assert result .matchreport ("test_sb_fixture" ).passed
7682
7783
@@ -88,7 +94,7 @@ def test_request_sb_fixture(request):
8894 sb.tearDown()
8995 """
9096 )
91- result = pytester .inline_run ("-- headless" , "-v" )
97+ result = pytester .inline_run (headless , "-v" )
9298 assert result .matchreport ("test_request_sb_fixture" ).passed
9399
94100
@@ -130,18 +136,22 @@ def test_failing(self):
130136 self.assert_equal('yes', 'no')
131137 """
132138 )
133- result = pytester .runpytest ("-- headless" , "--reruns=1" , "--rs" , "-v" )
139+ result = pytester .runpytest (headless , "--reruns=1" , "--rs" , "-v" )
134140 assert_outcomes (result , passed = 1 , failed = 1 , rerun = 1 )
135141
136142
137143def test_browser_launcher (pytester ):
138144 pytester .makepyfile (
139145 """
146+ import sys
140147 from seleniumbase import get_driver
148+ b = None
149+ if "win32" in sys.platform:
150+ b = "chs"
141151 def test_browser_launcher():
142152 success = False
143153 try:
144- driver = get_driver("chrome", headless=True)
154+ driver = get_driver("chrome", headless=True, binary_location=b )
145155 driver.get("data:text/html,<p>Data URL</p>")
146156 source = driver.page_source
147157 assert "Data URL" in source
@@ -151,20 +161,24 @@ def test_browser_launcher():
151161 assert success
152162 """
153163 )
154- result = pytester .inline_run ("-- headless" , "-v" )
164+ result = pytester .inline_run (headless , "-v" )
155165 assert result .matchreport ("test_browser_launcher" ).passed
156166
157167
158168def test_framework_components (pytester ):
159169 pytester .makepyfile (
160170 """
171+ import sys
161172 from seleniumbase import get_driver
162173 from seleniumbase import js_utils
163174 from seleniumbase import page_actions
175+ b = None
176+ if "win32" in sys.platform:
177+ b = "chs"
164178 def test_framework_components():
165179 success = False
166180 try:
167- driver = get_driver("chrome", headless=True)
181+ driver = get_driver("chrome", headless=True, binary_location=b )
168182 driver.get('data:text/html,<h1 class="top">Data URL</h2>')
169183 source = driver.page_source
170184 assert "Data URL" in source
@@ -176,5 +190,5 @@ def test_framework_components():
176190 assert success
177191 """
178192 )
179- result = pytester .inline_run ("-- headless" , "-v" , "-s" )
193+ result = pytester .inline_run (headless , "-v" , "-s" )
180194 assert result .matchreport ("test_framework_components" ).passed
0 commit comments