Posted by Pete McBreen 06 Feb 2022 at 04:48
irb, Elixir uses
irb and to be different Python jumps directly into the interactive prompt using
python. In each of these you have the full power of the language to use whatever libraries you have installed by just typing code at the relevant prompt. So at the
python prompt you could do the following to see how Playwright interacts with the browser - using code borrowed from an earlier post.
from playwright.sync_api import sync_playwright playwright = sync_playwright().start() browser = playwright.chromium.launch() page = browser.new_page() page.goto("https://www.selenium.dev/") page.click("#main_navbar :text('blog')") title = page.title() print(title)
The nice thing with each of these REPLs is that they allow you to see the type of the object and the associated attributes and methods, and hence get a better understanding of the library by trying things out and getting immediate success or failure - with an associated error message and stack dump, immediately followed by the REPL prompt for you to try again. Amusingly this even works for overly complex APIs like the Amazon Boto3 python library that you need to interact with the AWS services.