-
Notifications
You must be signed in to change notification settings - Fork 5
/
pool_test.go
44 lines (40 loc) · 1.04 KB
/
pool_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package rod_helper
import (
"github.com/WQGroup/logger"
"testing"
)
func TestNewMultiBrowser(t *testing.T) {
InitFakeUA(true, "", "")
browserOptions := NewPoolOptions(logger.GetLogger(), true, true, TimeConfig{
OnePageTimeOut: 15,
})
browserOptions.SetXrayPoolUrl("192.168.50.233")
browserOptions.SetXrayPoolPort("19038")
b := NewPool(browserOptions)
fInfo := NewFilterInfo("imdb", []PageInfo{
{
Name: "Most Popular Movies",
Url: "https://www.imdb.com/chart/moviemeter/",
PageTimeOut: 15,
SuccessWord: []string{"Most Popular Movies"},
ExistElementXPaths: []string{
`//*[@id="__next"]/main/div/div[3]/section/div/div[1]/div/div[2]/hgroup/h1`,
},
},
})
err := b.Filter(fInfo, 2, WebPageWithHttpClient)
if err != nil {
t.Fatal(err)
}
err = b.SetKeyName("imdb")
if err != nil {
t.Fatal(err)
}
proxyInfos, err := b.GetFilterProxyInfos(fInfo.KeyName)
if err != nil {
t.Fatal(err)
}
for _, proxy := range proxyInfos {
println(b.GetProxyInfos()[proxy].Index, b.GetProxyInfos()[proxy].Name)
}
}