0

I am using Selenium Webdriver with an Excel VBA automatization in Chrome and I am having some trouble when waiting until users clics a button.

The web's code is the following:

web code

I have tried with FindElementByCss, FindElementByID..., also with IsPresent, IsEnabled... but nothing worked. Mi code right now is the following:

t = Timer
    Do While bot.FindElementById("ui-button-text").IsPresent = True
        bot.Wait 500
        If Timer - t = 10 Then Exit Do 'Para evitar bucle infinito
    Loop

Thanks in advance!

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Rebeca B.
  • 19
  • 6
  • There is only one id, and there are multiple classes. When viewed in html, there is no setting for id. There is a possibility that there are multiple when viewed as a class. You have to check which order you are looking for among several. – Dy.Lee Feb 04 '21 at 14:14

1 Answers1

0

As per the HTML:

66044675

ui-button-text is the value of the class attribute, but not of the id attribute and there are multiple <span> elements with class attribute value as ui-button-text with different textContent.


To validate the presence of the elements you can use the following Locator Strategies:

  • Element with text as Cancelar:

    • Using xpath:

      Do While bot.FindElementByXPath("//span[@class='ui-button-text' and text()='Cancelar']").IsPresent = True
      
  • Element with text as Repetir:

    • Using xpath:

      Do While bot.FindElementByXPath("//span[@class='ui-button-text' and text()='Repetir']").IsPresent = True
      
  • Element with text as Aceptar:

    • Using xpath:

      Do While bot.FindElementByXPath("//span[@class='ui-button-text' and text()='Aceptar']").IsPresent = True
      

To validate the if the elements are enabled, you can use the following Locator Strategies:

  • Element with text as Cancelar:

    • Using xpath:

      Do While bot.FindElementByXPath("//span[@class='ui-button-text' and text()='Cancelar']").IsEnabled = True
      
  • Element with text as Repetir:

    • Using xpath:

      Do While bot.FindElementByXPath("//span[@class='ui-button-text' and text()='Repetir']").IsEnabled = True
      
  • Element with text as Aceptar:

    • Using xpath:

      Do While bot.FindElementByXPath("//span[@class='ui-button-text' and text()='Aceptar']").IsEnabled = True
      
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352