Код: Выделить всё
[FindsBy(How = How.XPath, Using = "//a[@attribute='some_value']")]
public IWebElement ElementDescription;
Код: Выделить всё
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.XPath("//a[@attribute='some_value']")));
Мой вопрос: будет ли метод для каждая функция работает лучше, если сам метод ожидает объект перед его использованием?
Код: Выделить всё
public IWebElement ElementDescription(int seconds = 30)
{
const string locator = "//a[@attribute='some_value']";
// Wait for the element to be visible before returning it
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(seconds));
IWebElement element = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.XPath(locator)));
// Return the element
return element;
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... nt-methods
Мобильная версия