Wednesday, 15 May 2013

javascript - Protractor xpath identification with lengthy xpath -


New to Protractor scripting.

There is no opinion on why I can not get the element in stack trace based on this low run?

  TempString = browser.driver.findElement (by.xpath ("/ html / body / section / div / form / section / section [2] / div / div / div [1] / Div / div / div [3] / div [2] / div [2] / div [1] / div [1] / h3 ")) gettext () .; This is the "monthly payment" field on the  mortgagecalculator.org  site. Trust 

  // span [contains ("., " Monthly payment ")] / Preceding-Separator :: H3  

Since there are two elements with the text" Monthly payment ", you can get both of them and before To get the desired one:

  var monthly payment = element.all (by.xpath (' // span [in (., "Monthly payment")] / predecessor- :: H3 ') monthly Payments. First (). GetText (); . MonthlyPayments.last () gettext ();  

No comments:

Post a Comment