Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "log"
- "time"
- "github.com/tebeka/selenium"
- "github.com/tebeka/selenium/chrome"
- )
- func main() {
- service, err := selenium.NewChromeDriverService("./chromedriver", 4444)
- if err != nil {
- log.Fatal("Serivce error")
- }
- defer service.Stop()
- proxy := "85.142.44.17:64654"
- caps := selenium.Capabilities{}
- chromeCaps := chrome.Capabilities{
- Args: []string{
- fmt.Sprintf("--proxy-server=%s", proxy),
- },
- Extensions: []string{"/home/den4ik/go-exps/extension"}, // Путь к вашему архивированному расширению
- }
- caps.AddChrome(chromeCaps)
- driver, err := selenium.NewRemote(caps, "http://127.0.0.1:4444/wd/hub")
- if err != nil {
- log.Fatalf("Failed to open a session: %v", err)
- }
- defer driver.Quit()
- // Пример отправки запроса
- if err := driver.Get("https://api.ipify.org"); err != nil {
- log.Fatalf("Failed to load page: %v", err)
- }
- time.Sleep(time.Hour)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement