sclevine / agouti

A WebDriver client and acceptance testing library for Go
MIT License
821 stars 103 forks source link

ChromeDriver doesn't work while PhantomJS works well #191

Closed quexer closed 5 years ago

quexer commented 5 years ago

Test case below will report an error. Am I missing anything? thanks

error:

 Expected success, but got an error:
      <*errors.errorString | 0xc0001882b0>: {
          s: "failed to navigate: request unsuccessful: invalid session id",
      }
      failed to navigate: request unsuccessful: invalid session id

suite_test.go


package admin_test

import (
    "testing"

    . "github.com/onsi/ginkgo"
    . "github.com/onsi/gomega"
    "github.com/sclevine/agouti"
)

func TestAdmin(t *testing.T) {
    RegisterFailHandler(Fail)
    RunSpecs(t, "Admin Suite")
}

var agoutiDriver *agouti.WebDriver

var _ = BeforeSuite(func() {
    //agoutiDriver = agouti.PhantomJS() //success
    agoutiDriver = agouti.ChromeDriver() // fail
    Expect(agoutiDriver.Start()).To(Succeed())
})

var _ = AfterSuite(func() {
    Expect(agoutiDriver.Stop()).To(Succeed())
})

var _ = Describe("Admin Home", func() {
    var page *agouti.Page

    BeforeEach(func() {
        var err error
        page, err = agoutiDriver.NewPage()
        Expect(err).NotTo(HaveOccurred())
    })

    AfterEach(func() {
        Expect(page.Destroy()).To(Succeed())
    })

    It("home", func() {
        Expect(page.Navigate("http://127.0.0.1:5000")).To(Succeed())
    })
})
williammartin commented 4 years ago

@quexer Did you ever resolve this?

quexer commented 4 years ago

@williammartin

No, I gave up PhantomJs and turned to chrome