Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using OpenQA.Selenium;
- using OpenQA.Selenium.Chrome;
- using System;
- class Program
- {
- static void Main()
- {
- // Create a proxy object
- var proxy = new Proxy
- {
- Kind = ProxyKind.Manual,
- IsAutoDetect = false,
- HttpProxy = "http://71.86.129.131:8080"
- };
- // Create a ChromeOptions instance and assign it the proxy settings.
- ChromeOptions options = new ChromeOptions();
- options.Proxy = proxy;
- // Set up the ChromeDriver instance
- IWebDriver driver = new ChromeDriver();
- // Navigate to target website
- driver.Navigate().GoToUrl("https://ident.me");
- // Add a wait for three seconds
- Thread.Sleep(3000);
- // Select the HTML body
- IWebElement pageElement = driver.FindElement(By.TagName("body"));
- // Get and print the text content of the page
- string pageContent = pageElement.Text;
- Console.WriteLine(pageContent);
- // Close the browser
- driver.Quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement