HTML is as follows:
<h3 data-testid="cartSubTotalAmt" class="inline bottom-offset-0 pull-right ng-binding">$39.00</h3>
I need to fetch the total summary value $39.00. Kindly help me to locate and fetch the value.
HTML is as follows:
<h3 data-testid="cartSubTotalAmt" class="inline bottom-offset-0 pull-right ng-binding">$39.00</h3>
I need to fetch the total summary value $39.00. Kindly help me to locate and fetch the value.
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");