In Flipkart page, I searched for Apple ipads and clicked on first search result. Here, I wanted to click on 'BUY NOW'.
Typical page looks like this:
I used the following xpath and it worked:
Then I used the xpath with 'contains' but it didn't work:
But none worked. I really surprised as to why 'contains' is not identifying the elements. I found the same behavior with 'Add to Cart' button as well.
Then I tried to identify another element - 'Wi-Fi+4G' with contains and it worked:
Both the above xpath worked for me.
So, can anyone please explain why 'contains' is not working here?
<button class="_2AkmmA _2Npkh4 _2kuvG8 _7UHT_c" type="button"><span class="_279WdV"></span> <!-- -->BUY NOW</button>. This is the html of the button.