32 lines
681 B
Go
32 lines
681 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/tebeka/selenium"
|
||
|
"github.com/tebeka/selenium/chrome"
|
||
|
)
|
||
|
|
||
|
func TestCase1(t *testing.T) {
|
||
|
caps := selenium.Capabilities{"browserName": "chrome"}
|
||
|
chromecaps := chrome.Capabilities{}
|
||
|
err := chromecaps.AddExtension("/home/eson/test/ssh-key/0.1.2_0.crx")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
caps.AddChrome(chromecaps)
|
||
|
_, err = selenium.NewChromeDriverService("/usr/bin/chromedriver", 3030)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
wd, err := selenium.NewRemote(caps, fmt.Sprintf("http://localhost:%d/wd/hub", 3030))
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
err = wd.Get("https://www.twitch.tv/directory/all")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|