How to target CSS button elements properly with VBA Selenium when they don't have any IDs? How to target CSS button elements properly with VBA Selenium when they don't have any IDs? selenium selenium

How to target CSS button elements properly with VBA Selenium when they don't have any IDs?


Please try either of this two methods.It should work.

findElementByXPath("//button[contains(text(), 'Apply')]")

Or

findElementByXPath("//button[text()[contains(.,'Apply')]]")

Or

driver.findElementByCssSelector("button.applyBtn")

Please let me know if this work.


You can reduce the css selector further and use a single class selector. Css selector method will be faster than xpath:

driver.findElementByCss(".applyBtn").click

The correct syntax is findElementByCss for VBA selenium basic