Mam taki mały problem z Selenium w C#. Pokazuje się błąd "NoSuchElementException was unhandled" gdy test dochodzi do wpisywania hasła.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;
namespace Selenium
{
class Program
{
static void Main(string[] args)
{
IWebDriver driver = new FirefoxDriver();
driver.Navigate().GoToUrl("http://www.t-mobilebankowe.pl");
IWebElement zaloguj = driver.FindElement(By.LinkText("Zaloguj"));
zaloguj.Click();
IWebElement login = driver.FindElement(By.Id("LoginID"));
login.SendKeys("login");
IWebElement button = driver.FindElement(By.LinkText("Zaloguj"));
button.Click();
IWebElement password = driver.FindElement(By.Id("login_password"));
//NoSuchElementException was unhandled
password.SendKeys("haslo");
}
}
}
teraz fragment html
<input class="x-form-text x-form-field aliorie8fix alior-textfield L x-form-invalid" autocomplete="off" maxlength="100" id="login_password" name="Credentials" type="password">
Oczywiście w kodzie podawałem poprawny login i hasło.
Co robię źle?