如何使用代理设置运行python-selenium

时间:2017-03-03 06:30:43

标签: python selenium selenium-webdriver proxy remotewebdriver

我实现了一个selenium-python代码来浏览网页。我能够使用远程webdriver运行该程序,没有任何代理墙。但是我需要在代理墙后面运行它。我无法确定是使用Proxy类还是使用Desired Capabilities实现代理? 在没有任何代理设置的情况下附加当前代码 PS。使用DOM对象模型

from driver import Webdriver
from selenium.webdriver.common.proxy import Proxy
import unittest,time
desired_capabilities = { 'browserName' : 'chrome' }
command_executor = "http://127.0.0.1:4444/wd/hub"
proxy_address = 'http://proxy-chain.companyname.com:911'

from base import Login_page


class testing_first_code(unittest.TestCase):
   def setUp (self):
     self.driver = Webdriver(desired_capabilities=desired_capabilities, command_executor=command_executor )

0 个答案:

没有答案