Donate

GeckoFx getElementByID() click() Method Missing

In an application that i am creating using Gecko FX version 15, I noticed that getElementsByTagName() has an invoke member click() as shown below:
this.Document.GetElementsByTagName(geckoElement.TagName)[indexSearchElement].Click();
But missing in getElementByID(). After experimenting for a few hours, I came up with the solution below:
((GeckoHtmlElement)this.Document.GetElementById(elemId)).Click();
The trick was to cast it as GeckoHtmlElement.
Greg

Comments

  1. tnx.
    solved my problem

    ReplyDelete
  2. Thanx! it helped me too!

    ReplyDelete
  3. For Each curElement As GeckoElement In theElementCollection
    If curElement.GetAttribute("name").Equals("signIn") Then
    curElement.InvokeMember("click") <= this doesn't not work
    End If
    Next

    help me,,,,,

    ReplyDelete
    Replies
    1. Hi,

      When using GetElementById() make sure that you are referencing the ID itself and not looping through the controlls collection. :)

      Delete

Post a Comment

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.