我在 java 中找到了许多关于 selenium 的教程,其中您首先使用 s.start("captureNetworkTraffic=True")
启动 selenium,但在 python 中 start()
不接受任何参数。
你如何传递这个论点?或者你不需要在 python 中使用它?
最佳答案
我更改了 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')
它就像一个魅力
关于python - Selenium-rc:如何在 python 中使用 CaptureNetworkTraffic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3712278/