我在java中找到了许多关于selenium的教程,在这些教程中,您首先使用s.start("captureNetworkTraffic=True")启动selenium,但是在python中,start()不接受任何参数。
如何传递此参数?或者,在python中不需要它吗?
发布于 2010-09-15 21:18:45
我在selenium.py中更改了start
def start(self, captureNetworkTraffic=False):
l = [self.browserStartCommand, self.browserURL, self.extensionJs]
if captureNetworkTraffic:
l.append("captureNetworkTraffic=true")
result = self.get_string("getNewBrowserSession", l)你要做的是:
sel = selenium.selenium('localhost', 4444, '*firefox', 'http://www.google.com')
sel.start(True)
sel.open('')
print sel.captureNetworkTraffic('json')它就像一种护身符
发布于 2010-09-15 04:11:49
在“代理注入模式”下启动浏览器(注意*pifirefox而不是*firefox)。然后,您可以调用captureNetworkTraffic方法。
import selenium
import time
sel=selenium.selenium("localhost",4444,"*pifirefox","http://www.google.com/webhp")
sel.start()
time.sleep(1)
print(sel.captureNetworkTraffic('json'))我学会了here的*pifirefox“诀窍”。
https://stackoverflow.com/questions/3712278
复制相似问题