Search code examples
watin

Cannot find the specific element with Find class in WatIN


I am trying to automate rest client but when I try to enter a value in the URL text-box it does not find the object by id and even by name

What I actually did was Find.ById and Find.ByName but it does not seem to find the element.


Solution

  • In order to do it, you need to override the existing functionality. Below is the code to get the textfield of type 'URL'.

    [ElementTag("input", InputType = "url", Index = 5)]
    public class CustomTextField : Element<CustomTextField>
    {
        public CustomTextField(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
        public CustomTextField(DomContainer domContainer, ElementFinder finder) : base(domContainer, finder) { }
    }