How to identify this button in C#:

 <button class="reward_link_redeem_button_style" onclick="RedeemRPProduct('free_points_1')">REDEEM</button>
 <button class="reward_link_redeem_button_style " onclick="RedeemRPProduct('free_points_50')">REDEEM</button>

But there are like 4 buttons called equal, and to differentiate them you need the ('free_points_1') as well as ('free_points_10'), etc.

  1. Using CSS selector

    .reward_link_redeem_button_style
    

    OR

    button[class='reward_link_redeem_button_style']
    
  2. Using xpath

    //button[contains(.,'REDEEM')]
    

    OR

    //button[contains(@onclick,'RedeemRPProduct')]
    

Update

As per recent update content. You can locate the element using onclick attribute as it make the element unique. Use below xpath :

//button[contains(@onclick,'free_points_50')]
  • But there are like 4 buttons called equal, and to differentiate them you need the ('free_points_1') as well as ('free_points_10'), etc. – Gabriel Lugo Oct 6 at 16:49
  • Can you update the question with some more HTML code so I can help you out – NarendraR Oct 6 at 16:50
  • Try this //button[contains(@onclick,'free_points_50')] make sure you have passed correct number – NarendraR Oct 6 at 18:49
  • @GabrielLugo, I have updated the answer as per your update.If this answer is helpful for you then please accept so it can be helpful for other. Have some other queries then please post. thanks – NarendraR Oct 9 at 7:15

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.