Document.getElementById() not available for Chromi

2019-09-09 21:30发布

When I open a browser as

WebBrowser browser1;

I am able to call

browser1.Document.getElementById();

but when I load the browser as

CromiumWebBrowser browser1;

it says "CefSharp.WinForms.ChromiumWebBrowser does not contain a definition for document".

I have loaded a google sheet on a Chromium browser. I simply want to enter "something" on the first cell.

Can anyone help?

2条回答
ゆ 、 Hurt°
2楼-- · 2019-09-09 21:33

After working out to load two browsers in one form in this Q&A, I just had to copy the value and paste it to the focused area on the second browser. That's the best I could do.

Clipboard.SetDataObject((value).ToString(), true);
browser2.Paste();

but now I need to solve another thing. I need to select the next cell on a google sheet. And I have created this Question

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-09-09 21:39

You can use this:

browser1.ExecuteScriptAsync("document.GetElementById('id1');");
查看更多
登录 后发表回答