I want to fetch the text "There are 4 products in your cart" in Selenium Webdriver using Java.
<h2>
<!-- Plural Case [both cases are needed because page may be updated in Javascript] -->
<span class="ajax_cart_product_txt_s unvisible" style="display: inline;">
There are
<span class="ajax_cart_quantity">4</span>
items in your cart.
</span>
<!-- Singular Case [both cases are needed because page may be updated in Javascript] -->
<span class="ajax_cart_product_txt " style="display: none;"> There is 1 item in your cart. </span>
</h2>
I have tried using getText() and innerHTML but it hasn't worked.