I’m trying to use Selenium VBA to find checkbox elements on a web page. Interestingly, when I open a local HTML file, I can easily find and click the checkboxes without any issues. However, when I run the same code on a live website, Selenium cannot find the elements and nothing happens.
Here is the part of the code I am using:
Set kurulumCheckbox = WaitForElement(driver, "xpath", "//input[@type='checkbox' and @name='svcType' and @value='I']", 30)
Set teslimatkurulumCheckbox = WaitForElement(driver, "xpath", "//input[@type='checkbox' and @name='svcType' and @value='X']", 30)
If Not kurulumCheckbox Is Nothing Then
kurulumCheckbox.Click
End If
If Not teslimatkurulumCheckbox Is Nothing Then
teslimatkurulumCheckbox.Click
End If
This code works perfectly with my local HTML file, but on the live website, I’m unable to find or click the checkboxes. I can’t figure out the difference between the two environments.
Browser: Chrome
Driver: Selenium VBA (ChromeDriver)
Wait Time: 30 seconds
XPath and Elements: I'm confident the XPath is correct because it works on the local HTML file.
Does anyone have suggestions for solving this issue? What extra checks should I perform when elements are not being found on live websites?
Thanks in advance for your help!
Ali can İnce is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.