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
-
I am also facing the same issue. not able to automate braintree field by selenium.user48304– user483042021年02月02日 10:13:24 +00:00Commented Feb 2, 2021 at 10:13
1 Answer 1
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);
Explore related questions
See similar questions with these tags.