New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to convert type *runtime.RemoteObject to string? #810
Comments
Another question: I am doing something like this: chromedp.EvaluateAsDevTools(`window.fool = function (txt){return txt}`, &res),
chromedp.Evaluate(`window.foo('a')`, &res), Does the |
for Q1: if res.Type == "string" {
val := string(res.Value)
log.Println(val)
} Please note that if the returned value is of type string (no for Q2: Try to combine the javascript code. var res string
// ...
chromedp.Evaluate("window.foo = function (txt){return txt};window.foo('a')", &res),
// ... |
for Q2: I have already thought about that, but what if the first evaluation returns an value, the second too, and I only want the second? |
@shelld3v You can have a test yourself. |
I am wondering if |
Currently, I want to get the raw response from
chromedp.EvaluateAsDevTools
. And from #526, I can see thatres
object must be in*runtime.RemoteObject
type. But how I can convert it back to a string? To check for something likeif res == "hello"
?Thanks a lot for taking time to read this!
The text was updated successfully, but these errors were encountered: