[DEV] Set chromedriver path with env variable (#1123)

pull/1133/head
vdot0x23 2020-06-19 11:25:41 +00:00 committed by GitHub
parent e43bc93047
commit 61883437cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -21,7 +21,12 @@ type WebDriverSession struct {
// StartWebDriverWithProxy create a selenium session. // StartWebDriverWithProxy create a selenium session.
func StartWebDriverWithProxy(proxy string, port int) (*WebDriverSession, error) { func StartWebDriverWithProxy(proxy string, port int) (*WebDriverSession, error) {
service, err := selenium.NewChromeDriverService("/usr/bin/chromedriver", port) driverPath := os.Getenv("CHROMEDRIVER_PATH")
if driverPath == "" {
driverPath = "/usr/bin/chromedriver"
}
service, err := selenium.NewChromeDriverService(driverPath, port)
if err != nil { if err != nil {
return nil, err return nil, err