I am working on web automation project using GeckoFX and I have encountered an obstacle that I cannot get through by myself.
There are some similar questions around here, but no one of them is answered, so I will try to explain my problem as good as I can.
When I open a "target=_blank" link, a new window automatically pops up (by default) I need to get control over it (eg resize).
I have tried to use CreateWindow event, which allowed me to cancel the popup. However, when I try to access the Webbrowser inside the popup by using Eventargs, everything just freezes and that's the end.
Here's the code, that I used:
void GeckoWB_CreateWindow2(object sender, GeckoCreateWindow2EventArgs e)
{
//This example works
e.Cancel = true;
//and this doesn't
//e.WebBrowser.Navigate(e.Uri);
}
Thank's in advance.
You can use e.InitialWidth and e.InitialHeight to control the size of the new window.
private void browser_CreateWindow(object sender, GeckoCreateWindowEventArgs e)
{
// Full Screen
Rectangle rect = System.Windows.Forms.Screen.GetWorkingArea(this);
e.InitialWidth = rect.Width;
e.InitialHeight = rect.Height;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.