playwright-community / playwright-go

Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.
https://playwright-community.github.io/playwright-go/
MIT License
1.94k stars 145 forks source link

content corrupted with some special characters #305

Closed kaiceo closed 1 year ago

kaiceo commented 1 year ago

// js code of content

 function fixHtmlEscapes(strTranslation) {
        var strText = unescape(strTranslation);
        strText = strText.replace(/'/gi, '"');
        strText = strText.replace(/«/gi, '\«');
        strText = strText.replace(/»/gi, '\»');
        strText = strText.replace(/‘/gi, '\‘');
        strText = strText.replace(/’/gi, '\’');
        strText = strText.replace(/“/gi, '\“');
        strText = strText.replace(/”/gi, '\”');
        return strText;
    }

screenshot: image

//my code
frEle, err := c.Page.QuerySelector(sel)
if err != nil {
     return err
}
fr, err = frEle.ContentFrame()
if err != nil {
    return err
}
fmt.Println(fr.Content())

return part content as below image