'ChromiumWebBrowser - How to add new Popup in a tab from code?
i can easly create a new tab inside of the tabcontrol with this code :
public void addNewTab3(string url)
{
TabPage tpage = new TabPage();
tpage.Text = "New Tab";
tabControl1.Controls.Add(tpage);
tabControl1.SelectTab(tabControl1.TabCount - 1);
ChromiumWebBrowser browser = new ChromiumWebBrowser(url);
browser.Parent = tpage;
browser.Dock = DockStyle.Fill;
}
.
chromeBrowser.ExecuteScriptAsync(@" document.getElementsByName('testbutton')[0].click();");
This opens a new window (popup), but how can the chromeBrowser.ExecuteScript.... opens a new tab and switch to them instead of a new window?
i tryed too with that code, but it too doesnt work :(
chromeBrowser.ExecuteScriptAsync(@"document.querySelector('.btn3').setAttribute('target', '_blank');");
chromeBrowser.ExecuteScriptAsync(@"document.querySelector('.btn3').click();");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
