How to Setup Private Proxy with Selenium?

前端 未结 3 1447
陌清茗
陌清茗 2021-01-16 18:03

I\'ve been trying for days to setup a private proxy (with authentication) in Selenium using Firefox. However, no matter what I do I\'v been unsuccessful.

Currently,

相关标签:
3条回答
  • 2021-01-16 18:37
    const {Builder, By, Key, until} = require('selenium-webdriver');
    const proxy = require('selenium-webdriver/proxy');
    (async function example(){
      let driver = await new Builder().forBrowser('firefox').setProxy(proxy.manual({
        http: 'zproxy.lum-superproxy.io:22225',
        https: 'zproxy.lum-superproxy.io:22225'
      })).build()
      try {
        await driver.get('http://lumtest.com/myip.json');
        driver.switchTo().alert()
          .sendKeys('lum-customer-USERNAME-zone-YOURZONE'+Key.TAB+'PASSWORD');
        driver.switchTo().alert().accept();
      } finally {
        await driver.quit();
      }
    })();
    

    Here is my sample code when I use Luminati proxy for Selenium.

    0 讨论(0)
  • 2021-01-16 18:38

    Find solution:

    proxy = Proxy({
        'proxyType': ProxyType.MANUAL,
        'httpProxy': PROXY_HOST,
        'socksUsername': 'name',
        'socksPassword': 'pass'
        })
    
    driver = webdriver.Firefox(proxy=proxy)
    
    0 讨论(0)
  • 2021-01-16 18:39

    You can try using browsermob proxy. Here you go for example

    0 讨论(0)
提交回复
热议问题