Home > Net >  Using C# I cannot sendKeys to an angular tag <app-currency-input> I get this error Element <
Using C# I cannot sendKeys to an angular tag <app-currency-input> I get this error Element <

Time:09-29

I have tried a bunch of solutions like implicit wait - this does not work, the text field is clickable by mouse but unreachable by keyboard, so values cannot be inputted but text field this can be clicked.

I also have this solution

             IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
             IWebElement element = driver.FindElement(By.Name("InvoiceAmount"));
             js.ExecuteScript("arguments[0].value='100';", element);

this does nothing and does not give any error also. Please help. Thank you.enter image description here

CodePudding user response:

Have you tried to find element and click before sending keys?

CodePudding user response:

It is bcz of that you found wrong element. You found <app-currency-input>. But you have to get a nested input (native <input> element).

    IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
    IWebElement element = driver.FindElement(By.Name("InvoiceAmount"));
    var inputElements= element.FindElements(By.TagName("input"));
    js.ExecuteScript("arguments[0].value='100';", inputElements[0]);
  • Related