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:
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!
As per the HTML:
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