I am trying to automate a reactjs application and the framework our project is using built on C# and protractor-net.
After any click or assert function I get the following error, but the defined action in the code executes successfully.
System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> OpenQA.Selenium.WebDriverTimeoutException : timeout
What is the cause of this error?
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Support.PageObjects;
using OpenQA.Selenium.Support.UI;
using Protractor;
using System;
using System.Collections.Generic;
public Class personalinformations
{
private NgWebDriver _ngdriver;
public PersonalInformations(IWebDriver driver)
{
_ngdriver = new NgWebDriver(driver);
PageFactory.InitElements(_ngdriver, this);
_ngdriver.IgnoreSynchronization = true;
}
[FindsBy(How = How.Id, Using = "btnSubmit")]
private IWebElement btnsave { get; set; }
public void saveSection()
{
WebDriverWait wait = new WebDriverWait(ngdriver, TimeSpan.FromSeconds(30));
wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*@id='btnSubmit']"));
btnsave.Click();
}
}
Note: While using Thread.Sleep(1000) for wait sometimes the code works.Also I tried with Javascript to click the element the result is same.