Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using OpenQA.Selenium;
- using OpenQA.Selenium.Chrome;
- class Scraper
- {
- static async Task Main()
- {
- string url = "https://scrapeme.live/shop/Pikachu/";
- // Set up Chrome WebDriver
- IWebDriver driver = new ChromeDriver();
- // Navigate to the URL
- driver.Navigate().GoToUrl(url);
- // Find the stock amount element using XPath
- IWebElement stockElement = driver.FindElement(By.XPath("//*[@id="product-752"]/div[2]/p[2]"));
- // Extract the stock amount text
- string stockAmount = stockElement.Text;
- Console.WriteLine("Stock Amount: " + stockAmount);
- // Close the WebDriver
- driver.Quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement