New window after clicking button (Geckofx)

  • 76 Views
  • Last Post 2 weeks ago
Matevsz posted this 3 weeks ago

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 3 weeks ago

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 2 weeks ago

Ok i try

Close