1

I'm trying to click a button using a VBA Chrome driver via Selenium but I get an ElementNotVisibleError

The HTML code for the button is -

<button class="base-button" id="primary-button" classnames="primary-button" title="Continue">Continue</button>

I've tried to check the element exists and VBA returns TRUE for the following -

MyBrowser.IsElementPresent(Findby.ID("primary-button"))

but when I try to click the button using the following code, i get the error -

MyBrowser.FindElementById("primary-button").Click
Vik
  • 469
  • 2
  • 6
  • 18
  • `IsElementPresent` is not the same as `IsElementVisible`. Have you tried the latter? Further, i assume the element IS actually visible in the browser, to yourself? – C. Peck Jul 25 '22 at 04:32
  • You could try another way to access it, by finding it by xPath. – ALeXceL Jul 25 '22 at 11:49
  • @C.Peck I'm unsure how to check if the element is visible in VBA, IsElementVisible isn't a command. The element is visible to myself in the browser. – Vik Jul 25 '22 at 20:02

1 Answers1

1

To click on the element you can use either of the following locator strategies:

  • Using FindElementByCss:

    MyBrowser.FindElementByCss("button.base-button#primary-button[title='Continue']").Click
    
  • Using FindElementByXPath:

    MyBrowser.FindElementByXPath("//button[@class='base-button' and @id='primary-button'][@title='Continue' and text()='Continue']").Click
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352