1

I am trying to run the following code.

SystemUtil.Run "Chrome.exe","https://www.mortgagecalculator.org/"
val = Browser(MortCalPage).Page(MortCalPage).WebElement("xpath:=//DIV/DIV/H3\[normalize-space\(\)=""\$.*").GetROProperty ("outertext")

But i am either getting "Failed to run the test due to an unknown error." or unable to find object error

Used a reg exp for xpath

Original Value of xpath after obj identification:

"xpath:=//DIV/DIV/H3\[normalize-space\(\)=""\$1,401\.63""\]"

Value of xpath after using reg ex:

"xpath:=//DIV/DIV/H3\[normalize-space\(\).*"
  • Please first verify that the problem is in the XPath part. Try `Browser(MortCalPage).Hightlight` and then `Browser(MortCalPage).Page(MortCalPage).Highlight`. – Motti Oct 24 '21 at 15:03
  • Few things going on there. You can't (easily) regex an xpath. You don't escape the characters in the xpath. Your quotation characters are in a bit of a mix. Try .WebElement("xpath:=//DIV/DIV/H3[normalize-space()='$1,401.63']", "index:=0"). - that assumes your xpath actually works. If you describe what you're trying to achieve with some information from you dom I'll be able to provide much more detail – RichEdwards Oct 25 '21 at 15:59

0 Answers0