MCPcopy Create free account
hub / github.com/tebeka/selenium / TestChrome

Function TestChrome

remote_test.go:134–181  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

132}
133
134func TestChrome(t *testing.T) {
135 if *useDocker {
136 t.Skip("Skipping Chrome tests because they will be run under a Docker container")
137 }
138 if _, err := os.Stat(*chromeBinary); err != nil {
139 path, err := exec.LookPath(*chromeBinary)
140 if err != nil {
141 t.Skipf("Skipping Chrome tests because binary %q not found", *chromeBinary)
142 }
143 *chromeBinary = path
144 }
145 if _, err := os.Stat(*chromeDriverPath); err != nil {
146 t.Skipf("Skipping Chrome tests because ChromeDriver not found at path %q", *chromeDriverPath)
147 }
148
149 var opts []ServiceOption
150 if *startFrameBuffer {
151 opts = append(opts, StartFrameBuffer())
152 }
153 if testing.Verbose() {
154 SetDebug(true)
155 opts = append(opts, Output(os.Stderr))
156 }
157
158 port, err := pickUnusedPort()
159 if err != nil {
160 t.Fatalf("pickUnusedPort() returned error: %v", err)
161 }
162
163 s, err := NewChromeDriverService(*chromeDriverPath, port, opts...)
164 if err != nil {
165 t.Fatalf("Error starting the ChromeDriver server: %v", err)
166 }
167 c := config{
168 addr: fmt.Sprintf("http://127.0.0.1:%d/wd/hub", port),
169 browser: "chrome",
170 path: *chromeBinary,
171 }
172
173 runTests(t, c)
174
175 // Chrome-specific tests.
176 t.Run("Extension", runTest(testChromeExtension, c))
177
178 if err := s.Stop(); err != nil {
179 t.Fatalf("Error stopping the ChromeDriver service: %v", err)
180 }
181}
182
183func testChromeExtension(t *testing.T, c config) {
184 caps := newTestCapabilities(t, c)

Callers

nothing calls this directly

Calls 8

StartFrameBufferFunction · 0.85
SetDebugFunction · 0.85
OutputFunction · 0.85
pickUnusedPortFunction · 0.85
NewChromeDriverServiceFunction · 0.85
runTestsFunction · 0.85
runTestFunction · 0.85
StopMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…