Selenium-rc: How do you use CaptureNetworkTraffic in python

前端 未结 2 1302
失恋的感觉
失恋的感觉 2021-02-15 16:52

I\'ve found many tutorials for selenium in java in which you first start selenium using s.start(\"captureNetworkTraffic=True\"), but in python start()

2条回答
  •  名媛妹妹
    2021-02-15 17:06

    Start the browser in "proxy-injection mode" (note *pifirefox instead of *firefox). Then you can call the captureNetworkTraffic method.

    import selenium
    import time
    
    sel=selenium.selenium("localhost",4444,"*pifirefox","http://www.google.com/webhp") 
    sel.start()
    time.sleep(1)
    print(sel.captureNetworkTraffic('json'))
    

    I learned the *pifirefox "trick" here.

提交回复
热议问题