0

I got another problem by finding the correct element for a radio button. We got two buttons, one for Visa and one for MasterCard. They are build identically, except for the value. enter image description here

I tried:

wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@type= 'radio'][@value='V']"))).click()

or different combinations from these attributes. There isn't a frame or something like that. Acutally, I should be inside the scope.

1
  • Are you getting any error when you click on the radio button? Commented May 25, 2021 at 12:38

1 Answer 1

2

Try the following for visa:

//img[contains(@src,'visa.svg')]/..

The same for mastercard:

//img[contains(@src,'mastercard.svg')]/..

or

//img[contains(@src,'visa.svg')]/../../label
//img[contains(@src,'mastercard.svg')]/../../label

Both should work

Sign up to request clarification or add additional context in comments.

3 Comments

Wow nice! It worked. Thank you so much. But what does /../../ this mean? Never seen this kind of syntax in combination with Xpath.
/.. to go to parent from current node
Or in other words "Go level Up"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.