Hi Guys,
when using
//img[contains(@alt, "air")]
as query on xpath chrome on one of the website, I am getting the image in highlights
however when I use the same syntax on VB
findelementbyxpath ("//img[contains(@alt, 'air')]
it is not able to find the element and popping an error.
Any suggestions please.
Have you checked the syntax? Does not look to be correct:
findelementbyxpath ("//img[contains(@alt, 'air')]
The 3 chars in red don't have the pair (opening or closing char). What's with the closing square bracket for?
It seems like there might be a syntax or quoting issue in your VB code. When using XPath in VB, you need to make sure that the syntax is correct and that the quotes are properly formatted. Here's the corrected version of your code:
.FindElementByXPath("//img[contains(@alt, 'air')]")
In VB, you can use either single quotes (' ') or double quotes (" ") to enclose the XPath expression. Make sure that you are using the correct quotes and that there are no syntax errors in your code. Additionally, ensure that you are calling the `FindElementByXPath` method correctly within your VB script.
If you continue to encounter errors, double-check the XPath expression for accuracy and verify that the element you are trying to locate actually exists on the webpage. If the issue persists, providing more context or the specific error message you're receiving would help in diagnosing the problem further.