3

On my application payment gateway is Braintree, I need to automate it and face some difficulties when I am automating it, the major problem is I cannot send credit card details using xpath, I research some tutorial for solve this and not find any good resources, please advise and guide me how I automate payment form using selenium

1
  • I am also facing the same issue. not able to automate braintree field by selenium. – user48304 Feb 2 at 10:13
0

To achieve the required automation testing services, you will have to use switchTo frame as mentioned in the link, https://stackoverflow.com/questions/9942928/how-to-handle-iframe-in-selenium-webdriver-using-java

Also, for braintree the locators may differ from what you see while using inspection tool , so I will suggest to confirm the actual locators by printing the page source and checking.

You might land into domain security problem while switching to the Braintree iframe. You may try workarounds as per link, https://appium.io/docs/en/advanced-concepts/cross-domain-iframes/

And lastly, if nothing else works you can try to find co-ordinates of the credit card text field relative to some other element that webdriver can find and then simply use sendKeys(). Something like,

Actions actions = new Actions(webDriver);

actions.moveToElement(some_findable_element, x_distance_to_cc_field, x_distance_to_cc_field).click().perform();

actions.sendKeys(cc_number);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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