Closed
Description
New feature: selenium-wire integration.
selenium-wire
gives you access to driver.requests
.
SeleniumBase is adding a selenium-wire integration using --wire
:
pytest --wire
Here's how it looks with BaseCase
inheritance:
from seleniumbase import BaseCase
class TestWire(BaseCase):
def test_wire_inside_class(self):
self.open("https://seleniumbase.io/demo_page")
for request in self.driver.requests:
print(request.url)
Here's how it looks with the sb
fixture:
def test_wire_with_no_class(sb):
sb.open("https://seleniumbase.io/demo_page")
for request in sb.driver.requests:
print(request.url)
class TestWire:
def test_wire_inside_class(self, sb):
sb.open("https://seleniumbase.io/demo_page")
for request in sb.driver.requests:
print(request.url)
Here's how it looks with the SB
Manager:
from seleniumbase import SB
with SB(wire=True) as sb:
sb.open("https://seleniumbase.io/demo_page")
for request in sb.driver.requests:
print(request.url)
Here's how it looks with the Driver
Manager:
from seleniumbase import Driver
driver = Driver(wire=True)
driver.get("https://seleniumbase.io/demo_page")
for request in driver.requests:
print(request.url)
In order to change the proxy in the middle of a test, there will be a new method added:
self.set_wire_proxy("SERVER:PORT")
self.set_wire_proxy("socks5://SERVER:PORT")
self.set_wire_proxy("USERNAME:PASSWORD@SERVER:PORT")
When using sb
, the call will look like this:
sb.set_wire_proxy("SERVER:PORT")
sb.set_wire_proxy("socks5://SERVER:PORT")
sb.set_wire_proxy("USERNAME:PASSWORD@SERVER:PORT")