Quantcast
Channel: Active questions tagged paypal - Stack Overflow
Viewing all articles
Browse latest Browse all 471

Playwright test failing in headless mode due to Paypal button

$
0
0

I have a Playwright test that confirms an e-commerce site's checkout process works, which terminates in clicking a Paypal button, logging into Paypal, and clicking submit payment.

In headed mode, it can interact with the Paypal popup just fine, but in headless mode, the Paypal widget doesn't render at all, and therefore there's no button to click. I've confirmed this using Playwright's page.screenshot() method.

From what I've read, this is a common problem because Paypal doesn't know their customers write integration tests, and therefore they treat any headless usage as evil bots trying to hack their sandbox site.

Is there any known workaround?

I'm running my test as part of a Django test case and the relevant Playwright startup code looks like:

SHOW = bool(int(os.environ.get('SHOW', 0)))class Tests(StaticLiveServerTestCase):    @classmethod    def setUpClass(cls):        os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true"        super().setUpClass()        cls.playwright = sync_playwright().start()        cls.browser = cls.playwright.chromium.launch(headless=not SHOW)

I've tried passing in "--disable-web-security", "--use-gl=desktop", "--disable-features=IsolateOrigins", and "--disable-site-isolation-trials", to launch(args=[...]) but those either have no effect or break the Paypal widget even in headed mode.


Viewing all articles
Browse latest Browse all 471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>