-1

HTML is as follows:

<h3 data-testid="cartSubTotalAmt" class="inline bottom-offset-0 pull-right ng-binding">$39.00</h3>

enter image description here

I need to fetch the total summary value $39.00. Kindly help me to locate and fetch the value.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

0

As per the HTML you have shared to extract the text of the total summary value i.e. $39.00 you need to induce WebDriverWait for the desired element to be visible and you can use either of the following solutions:

  • CssSelector:

    new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until(ExpectedConditions.ElementIsVisible(By.CssSelector("h3[data-testid='cartSubTotalAmt']"))).GetAttribute("innerHTML");
    
  • XPath:

    new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until(ExpectedConditions.ElementIsVisible(By.XPath("//h3[@data-testid='cartSubTotalAmt']"))).GetAttribute("innerHTML");
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352