0

I'm trying to use Selenium for Python to open Chrome and visit a webpage and would like to do a waitFor that waits for a particular outbound network request from the page I'm visiting to be completed. In an ideal world, there would be a waitForNetworkRequest function like this:

driver = webdriver.get('https://www.somesite.com')
driver.waitForNetworkRequest(url='https://www.othersite.com', status='completed')

Is there anything built into Selenium or other libraries that might achieve this?

3
  • As far as I know, there's no way to do this in Selenium without adding on a module like selenium-wire or by running the requests through a proxy you control, so you can detect the outgoing request there. Commented Sep 4, 2024 at 0:15
  • @Grismar Any info on how to do this in Selenium-wire, or other library, would be appreciated! Commented Sep 4, 2024 at 15:32
  • StackOverflow is not a place to ask for recommendations, and also not intended to ask people to code for you. I kept my comment short because you asked if it could be done with just Selenium and I think that's going to be very hard (though you might be able to do something clever with JavaScript in the browser), so I think looking for a library on top of Selenium or using a proxy is the right way to go. You should look at what solution you like, read some of the examples or documentation, and try a solution - feel free to ask if you run into trouble. stackoverflow.com/help/how-to-ask Commented Sep 4, 2024 at 22:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.