ADD: Dockerfile for chrome and selenium webdriver
FIX: session.FocusOnFrame error handling
Showing
1 changed file
with
5 additions
and
2 deletions
... | @@ -86,7 +86,7 @@ func crawlingNaverCafe(cafeUrl string) (string, int, string, string) { | ... | @@ -86,7 +86,7 @@ func crawlingNaverCafe(cafeUrl string) (string, int, string, string) { |
86 | if err != nil { | 86 | if err != nil { |
87 | log.Println(err) | 87 | log.Println(err) |
88 | } | 88 | } |
89 | - desired := webdriver.Capabilities{"Platform": "MacOS"} | 89 | + desired := webdriver.Capabilities{"Platform": "Linux"} |
90 | required := webdriver.Capabilities{} | 90 | required := webdriver.Capabilities{} |
91 | session, err := driver.NewSession(desired, required) | 91 | session, err := driver.NewSession(desired, required) |
92 | if err != nil { | 92 | if err != nil { |
... | @@ -97,7 +97,10 @@ func crawlingNaverCafe(cafeUrl string) (string, int, string, string) { | ... | @@ -97,7 +97,10 @@ func crawlingNaverCafe(cafeUrl string) (string, int, string, string) { |
97 | log.Println(err) | 97 | log.Println(err) |
98 | } | 98 | } |
99 | time.Sleep(time.Second * 1) | 99 | time.Sleep(time.Second * 1) |
100 | - session.FocusOnFrame("cafe_main") | 100 | + err = session.FocusOnFrame("cafe_main") |
101 | + if err != nil { | ||
102 | + log.Fatal(err) | ||
103 | + } | ||
101 | resp, err := session.Source() | 104 | resp, err := session.Source() |
102 | 105 | ||
103 | html, err := goquery.NewDocumentFromReader(bytes.NewReader([]byte(resp))) | 106 | html, err := goquery.NewDocumentFromReader(bytes.NewReader([]byte(resp))) | ... | ... |
-
Please register or login to post a comment