Get HTML Value into a Text String ?

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Get HTML Value into a Text String ?

Postby Glenn » Fri May 03, 2019 8:44 am

How can I get the list_price in the HTML below into a string variable using the browser? I tried the code below but response.Result is null.

Code: Select all
<tr><td colspan="3" nowrap="nowrap" class="product_option">Retail Price: <span id="list_price" class="list_price">$20.95</span></td></tr>


Code: Select all
string script = string.Format("document.getElementById('list_price').value;");

chromeBrowser.ExecuteScriptAsync(script).ContinueWith(x =>
 {
         var response = x.Result;

         if (response.Success && response.Result != null)
         {
              var listPrice = response.Result;
          }
});
Glenn
Newbie
 
Posts: 5
Joined: Thu May 02, 2019 10:27 am

Re: Get HTML Value into a Text String ?

Postby Czarek » Thu May 09, 2019 7:11 am

I guess you would have to use js bindings to return value from js. CefSharp support channel is here: https://gitter.im/cefsharp/CefSharp
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 24 guests