wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.86k stars 240 forks source link

is it possible to use request interceptor with third a remote browser? #709

Open jordibonastrem opened 10 months ago

jordibonastrem commented 10 months ago

so im using adsbrowser currently, i have tried to setup requestinterceptor with adsbrowser but it doesnt interfere the requests, here is the code i use to create driver

    response = requests.post("http://local.adspower.net:50325/api/v1/user/create", json=payload)
    id = response.json()["data"]["id"]

    open_url = "http://local.adspower.com:50325/api/v1/browser/start?user_id=" + id
    resp = requests.get(open_url).json()
    if resp["code"] != 0:
        print(resp["msg"])
        print("please check ads_id")
        return
    chrome_driver = resp["data"]["webdriver"]
    caps = DesiredCapabilities().CHROME
    caps["pageLoadStrategy"] = "eager"
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_experimental_option("debuggerAddress", resp["data"]["ws"]["selenium"])
    driver = webdriver.Chrome(chrome_driver, options=chrome_options,desired_capabilities = caps)

i think the problem is that in order to use adsbrowser i need to use remote browser

    chrome_options.add_experimental_option("debuggerAddress", resp["data"]["ws"]["selenium"])