WebDriver не видит элемент. "Element is not currently visible and so may not be interacted with"

Всем привет.

У меня проблема с поиском элемента. Есть вот такой спан:

<span helptext="Indicate if currently, or within the past 12 months, the client had any long-term care insurance policies or riders (including healthcare service or health maintenance organization contracts) in force or pending." class="dataControl HasHelpText" id="ctl08_ctl02_ctl03_ctl01_ctl00_ctl02_ctl06_ctl02_ctl01_ctl02_ctl01_sb0x0">

Получается найти его только по полному xPath/CssPath или id, но это не устраивает, т.к. может поменяться. Пробовал следующие варианты поиска:

[FindsBy(How = How.XPath, Using = "//td[contains(text(),'Currently, or within the past 12 months, has the client had any long-term care insurance policies or riders (including healthcare service or health maintenance organization contracts) in force or pending?')]/following-sibling::*/span")]

[FindsBy(How = How.XPath, Using = "//span[@helptext='Indicate if currently, or within the past 12 months, the client had any long-term care insurance policies or riders (including healthcare service or health maintenance organization contracts) in force or pending.']")]

[FindsBy(How = How.CssSelector, Using = "span[helptext='Indicate if currently, or within the past 12 months, the client had any long-term care insurance policies or riders (including healthcare service or health maintenance organization contracts) in force or pending.']")]

Метод:

 public void FillQuestionnairePage(string user, string env)
{
devLTCQuestion1.FindElement(By.CssSelector("input[value='False']")).Click();
}

Эти варианты не работают. В Nunit появляется ошибка “Element is not currently visible and so may not be interacted with”.

Версия WebDriver 2.53

Вопрос: Почему возникает эта ошибка и как это исправить?
Буду благодарен за помощь.

Скрин кода ниже:

Скрин страницы:

Уточняющие вопросы:

  1. Выше по дереву елементов случайно нет iFrame?
  2. Пробовали использовать wait перед тем как взаимодействовать с элементом? Может он отрисовыватся не успевает перед командой devLTCQuestion1.FindElement
  3. Элемент с таким локатором один на странице? Возможно их несколько а вебдрайвер возвращфет первый найденный, который не видно.

Если страница где-то в паблике могу помочь с локатором “по-живому” или на крайний случай сбросьте полный HTML страницы.

  1. iFrame нет
  2. Thread.Sleep() пробовал до 10000 - нет результатов
  3. На других страницаъ этого приложения прекрасно работает xPath с following-sibling, но не здесь
  4. Код страницы большой, поэтому в архиве
    MEGA

Как вариант попробуй
//tr[11]//*[@helptext=‘Indicate if currently, or within the past 12 months, the client had any long-term care insurance policies or riders (including healthcare service or health maintenance organization contracts) in force or pending.’]

Из иследованного:

  1. Первый селектор находит 4 элемента
  2. Второй селектор - 2 элемента
  3. td-шек с текстом “Currently, or within the past 12 months, has the client had any long-term care insurance policies or riders (including healthcare service or health maintenance organization contracts) in force or pending?” на странице две. Пробовал ка-то идентифицировать по паренту не получилось. Вроде есть уникальные атрибуты но есть подозрение что их значения динамически формируются. Быстрый способ отличить их это порядок следования на странице вверху вниз.
    Xpath для первого выглядит так - (//td[contains(text(),‘Currently, or within the past 12 months, has the client had any long-term care insurance policies or riders (including healthcare service or health maintenance organization contracts) in force or pending?’)])[1]
    Для второго соответственно то же самое только [2] в конце

Для цели выбора радиобатона предлагаю следующий подход:

  1. Ищем родителя tr у которого есть нужный нам td.
    селектор выглядит так: (//tr[(td[contains(text(),‘Currently, or within the past 12 months, has the client had any long-term care insurance policies or riders (including healthcare service or health maintenance organization contracts) in force or pending?’)])])[1]
    где [1] порядковый номер нужного элемента: первый или второй
  2. Далее прямо у родителя спрашиваем .FindElement(By.CssSelector(“input[value=‘False’]”)) и кликаем Screenshot by Lightshot

Предпологаю проблема в том, что по селекторам, которые Вы использовали, дрейвер находил несколько элементов. Когда такое случается, то драйвер возвращает первый найденный элемент и скорее всего это был не нужный Вам элемент, а какой-то другой невидимый.

Благодарю за подсказки.

Попробовал в Firepath достучаться до спана с помощью CssSelector
span[helptext='Indicate if currently, or within the past 12 months, the client had any long-term care insurance policies or riders (including healthcare service or health maintenance organization contracts) in force or pending.']

проверил через XPath

(//tr[(td[contains(text(),'Currently, or within the past 12 months, has the client had any long-term care insurance policies or riders (including healthcare service or health maintenance organization contracts) in force or pending?')])])[1]

Обнаружил, что у родительской tr-ки атрибут style=“display:none;”
Firebug этого не показывал

selenium как бы намекает, что елемент невидем и с ним не выйдет работать активно (жмакать, инпутить)

Верю. Но при поиске по id все прекрасно работает