简体   繁体   English

如何在BrowserMob Selenium和Python中运行多个服务器

[英]How to run Multiple Servers in BrowserMob Selenium and Python

Hi all I want to run multiple browsermob servers in python(want to detect http of two chrome browsers simultaneously but in a way that it can be separated later), however when I assign second server to second proxy I get the error 'No json object could be decoded' 大家好,我想在python中运行多个browsermob服务器(想同时检测两个chrome浏览器的http,但可以稍后再分离),但是当我将第二个服务器分配给第二个代理服务器时,出现错误'No json object可以被解码'

My code is following 我的代码如下

server1 = Server(path_browsermobproxy, options={'port':9090})
server1.start()
proxy1 = server1.create_proxy()



profile1 = webdriver.FirefoxProfile()
profile1.set_proxy(proxy1.selenium_proxy())


server2 = Server(path_browsermobproxy, options={'port':9091})
server2.start()
proxy2 = server2.create_proxy()

profile2 = webdriver.FirefoxProfile()
profile2.set_proxy(proxy2.selenium_proxy())

download the latest version 下载最新版本

https://github.com/automatedtester/browsermob-proxy-py https://github.com/automatedtester/browsermob-proxy-py

then pass a new proxy port create_proxy({"port":9911}) 然后传递一个新的代理端口create_proxy({“ port”:9911})

browsermobproxy will always try to use the port 8081 the the second instance will silently crash browsermobproxy将始终尝试使用端口8081,第二个实例将自动崩溃

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM