New window after clicking button (Geckofx)

  • 324 Views
  • Last Post 05 September 2018
Matevsz posted this 01 September 2018

Hello, how to make a new window in the program? use GeckoCreateWindow2? if so how?

My code:

using Gecko;

public Form1()
{
    InitializeComponent();
    Xpcom.Initialize("Firefox");
}

private void Form1_Load(object sender, EventArgs e)
{
    geckoWebBrowser1.Navigate("htpps://exampleSite.com");
}

private void button3_Click(object sender, EventArgs e)
{
    GeckoHtmlElement ButtonElement2 = (GeckoHtmlElement)geckoWebBrowser1.DomDocument.GetElementById("likeText");
    ButtonElement2.Click(); //<---- after clicking, a new window open
}

Screen:

Order By: Standard | Newest | Votes
lucy posted this 04 September 2018

I think you should write

private void button3_Click(object sender, EventArgs e)
{
    GeckoHtmlElement ButtonElement2 = (GeckoHtmlElement)geckoWebBrowser1.DomDocument.GetElementById("likeText");
    //get url new link
    //ButtonElement2.Click(); //<---- after clicking, a new window open
    using(Form1 frm = new Form1(ButtonElement2.Url))
    {
        frm.geckoWebBrowser1.Navigate(frm.Url);
        frm.Show();
    }
}
Matevsz posted this 05 September 2018

Ok i'll try

Close