Hello,
I am using the CefSharp Chromium browser control.
I now enter the url: "https://www.test.com/". Now I try to get all class names which exist on this URL using the code below but I get the error for this line like this:
MessageBox.Show($"{((dynamic)result.Result).Count}"); //**Cannot perform runtime binding on a null reference**
I wonder how I can get all class names which exist on this URL, - in a List correctly with the below code?
This code installs the cefsharp browser from Nuget:
Install-Package CefSharp.WinForms -Version 91.1.211
Thank you!
using CefSharp;
using CefSharp.WinForms;
public ChromiumWebBrowser browser;
public void InitBrowser()
{
Cef.Initialize(new CefSettings());
browser = new ChromiumWebBrowser("https://uniswapv3.flipsidecrypto.com");
this.Controls.Add(browser);
browser.Dock = DockStyle.Fill;
}
public Form1()
{
InitializeComponent();
InitBrowser();
}
async void getAllClasses()
{
var script = @"(function() { return document.querySelectorAll('[class]'); })();";
var result = await browser.EvaluateScriptAsync(script);
//How to get all classes in a List?
List<String> allClassLIST = new List<String>();
MessageBox.Show($"{((dynamic)result.Result).Count}"); //Cannot perform runtime binding on a null reference
}