You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ go list -m github.com/chromedp/chromedpgithub.com/chromedp/chromedp v0.9.3
$ google-chrome --version119.0.6045.123
$ go versiongo version go1.20.6 linux/amd64
What did you do? Include clear steps.
I am facing an issue with css property. Let me explain the flow, I am getting the style from api , and implementing it inline on the html. This html including the style is being scanned on backend and the html is captured.At the time of html capturing font-size property is being removed.And rest all the other property works fine.
url := "url_from_where_you want to capture html"
componentSelector := "#root"
html := CaptureHtml(url, componentSelector)
fmt.Println(html)
return
}
func CaptureHtml(url string, componentSelector string) (template.HTML, error) {
ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()
err := chromedp.Run(ctx, chromedp.Navigate(url), chromedp.WaitVisible(componentSelector, chromedp.ByQuery))
if err != nil {
fmt.Println(err)
return "", err
}
// Sleep to ensure the data rendering is complete
time.Sleep(2 * time.Second)
var htmlContent string
// Capture the HTML content of the element containing the rendered API data
err = chromedp.Run(ctx, chromedp.OuterHTML(componentSelector, &htmlContent, chromedp.NodeVisible))
if err != nil {
fmt.Println(err)
}
return template.HTML(htmlContent), err
}
What could be the reason of a particular css property being removed?
The text was updated successfully, but these errors were encountered:
I don't really understand then what you mean that the CSS property is being removed. What CSS property, etc. I would suggest using the chromedp.WithDebugf context option to try to get a sense of the messages being sent to/from Chrome. It might shed light on what Chrome is doing. chromedp is fairly simple -- other than setting up high-level API calls to make using chromedp more similar to using the browser's DevTools or how Puppeteer works, chromedp doesn't send any requests to Chrome to alter or modify the content.
What versions are you running?
What did you do? Include clear steps.
I am facing an issue with css property. Let me explain the flow, I am getting the style from api , and implementing it inline on the html. This html including the style is being scanned on backend and the html is captured.At the time of html capturing font-size property is being removed.And rest all the other property works fine.
What could be the reason of a particular css property being removed?
The text was updated successfully, but these errors were encountered: