I was using Page Object Model with Selenium and Java and I used the below codes to explicitly wait for the element before any action , but I am having trouble implementing the same using C#.
In Java
definition of element as per Page Object Model:
@FindBy(id="btnLogin")
protected WebElement m_btn;
waiting for the element :
WebDriverWait wait = new WebDriverWait(driver,120);
wait.until(ExpectedConditions.visibilityOf(m_btn));
m_btn.click();
C#
definition of element as per Page Object Model:
[FindsBy(How = How.Id, Using = "btnLogin")]
protected IWebElement m_btn;
waiting for the element :
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(ExpectedConditions.ElementIsVisible(m_btn));
I understand that , it need a By locator , but I have already defined the element as per the Object Model.
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(ExpectedConditions.ElementIsVisible(By.Id("btnLogin")));
How I can accomplish the explicit waiting on the already defined element without redefining by id again.
Appreciate any help..