Advertisement
dereksir

Untitled

Mar 4th, 2024 (edited)
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. import undetected_chromedriver as uc
  2. from selenium.webdriver.common.by import By
  3.  
  4. # define proxy details
  5. PROXY = '50.168.163.183:80'
  6.  
  7. # set Chrome options
  8. options = uc.ChromeOptions()
  9. # add proxy to Chrome options
  10. options.add_argument(f'--proxy-server={PROXY}')
  11.  
  12. # intialize uc instance with configured options
  13. driver = uc.Chrome(options=options)
  14.  
  15. # navigate to target website
  16. driver.get('https://httpbin.io/ip')
  17.  
  18. # retrieve text content of the page
  19. textContent = driver.find_element(By.TAG_NAME, 'body').text
  20. print(textContent)
  21.  
  22. driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement