Deploying to Kubernetes
We offer a Helm chart to deploy these Docker images to Kubernetes. Read more details at the Helm readme.
dưới dây là command helm để install selenium trên k8s
# Add docker-selenium helm repository helm repo add docker-selenium https://www.selenium.dev/docker-selenium # Update charts from docker-selenium repo helm repo update # List all versions present in the docker-selenium repo helm search repo docker-selenium --versions # Install basic grid latest version helm install selenium-grid docker-selenium/selenium-grid # Or install full grid (Router, Distributor, EventBus, SessionMap and SessionQueue components separated) helm install selenium-grid docker-selenium/selenium-grid --set isolateComponents=true # Or install specified version helm install selenium-grid docker-selenium/selenium-grid --version <version> # In both cases grid exposed by default using ingress. You may want to set hostname for the grid. Default hostname is selenium-grid.local. helm install selenium-grid --set ingress.hostname=selenium-grid.k8s.local docker-selenium/chart/selenium-grid/.
Và đây là hình ảnh deploy selenium trên argocd

Bạn truy cập vào selenium thông qua host mà bạn đã cấu hình
http://<domain>/ui#/sessions
user: admin
pass: admin
sau đó mình dùng code golang đơn giản:
package main
import (
"fmt"
"log"
"time"
"github.com/tebeka/selenium"
)
func main() {
// Selenium Hub URL
const (
seleniumPath = "http://admin:admin@<domain>/wd/hub"
)
// Connect to Selenium Hub
caps := selenium.Capabilities{"browserName": "chrome"}
wd, err := selenium.NewRemote(caps, seleniumPath)
if err != nil {
log.Fatalf("Failed to open session: %v", err)
}
defer wd.Quit()
// Navigate to Google
err = wd.Get("https://www.google.com")
if err != nil {
log.Fatalf("Failed to load page: %v", err)
}
// Sleep for visualization purposes
time.Sleep(5 * time.Second)
fmt.Println("Test finished successfully!")
}


Pass ở đây thường là secret.

Bạn có bật debug trên selenium
selenium.SetDebug(true)