Advertisement
dereksir

Untitled

Mar 18th, 2024 (edited)
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. # import required library
  2. import seleniumwire.undetected_chromedriver as UC
  3.  
  4. # set Chrome Options
  5. chrome_options = uc.ChromeOptions()
  6.  
  7. # define your proxy settings
  8. proxy_options = {
  9.     'proxy': {
  10.         'http': 'http://username:password@ip:port',
  11.         'https': 'https://username:password@ip:port'
  12.     }
  13. }
  14.  
  15. # initialize Chrome driver instance with specified proxy settings
  16. driver = uc.Chrome(
  17.     options=chrome_options,
  18.     seleniumwire_options=proxy_options
  19. )
  20.  
  21. # navigate to target website
  22. driver.get('https://httpbin.io/ip')
  23.  
  24. # retrieve the text content of the page
  25. textContent = driver.find_element(By.TAG_NAME, 'body').text
  26. print(textContent)
  27.  
  28. driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement