pythontestingplaywright

Using Opera, Safari, Brave with playwright


I'm trying to use various browsers for my tests, as long as I know, playwright has a browser called webkit which could be the equivalent to Safari and Opera but, is there a way to actually run Safari and other browsers instead of webkit?

For Chrome and Edge I only had to add chanel="msedge"/chanel="chrome" in the browser creation line, to get it open edge/chrome:

browser = playwrights.chromium.launch(channel='msedge', headless=False)

Is there something similar for Opera, Safari, etc.? Or there is another way to use those browsers for the test? I can't find the answer in their documentation.


Solution

  • Playwright will work with proprietary Chromium-based browsers (including Opera, Edge, Chrome etc.), you can install the browser independently from Playwright and then pass path to its executable via execuable_path launch option:

    browser = playwrights.chromium.launch(executable_path='/opt/path_to_opera_bin')
    

    For automating WebKit and Firefox Playwright currently requires remote debugging protocol which is only available in the custom builds.