Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example;
- // import required library
- import com.microsoft.playwright.*;
- public class Main {
- public static void main(String[] args) {
- // initialize Playwright
- try (Playwright playwright = Playwright.create()) {
- // launch browser
- Browser browser = playwright.webkit().launch();
- // open a new page
- Page page = browser.newPage();
- // navigate to target web page
- page.navigate("https://scrapeme.live/shop/Pikachu/");
- // extract product price using selector
- String price = page.innerText("#product-752 > div.summary.entry-summary > p.price > span");
- System.out.println("Product Price: " + price);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement