Posts

Showing posts with the label event-handling

How can I get a intermediate URL from a redirect chain from Selenium using Python?

How can I get a intermediate URL from a redirect chain from Selenium using Python? I'm using Selenium with Python API and Firefox to do some automatic stuff, and here's my problem: So is there a way to get the intermediate redirect URL b.com/some/path?arg=value with Selenium Python API? I tried driver.current_url but when the browser is on b.com , seems the browser is still under loading and the result returned only if the final address c.com is loaded. driver.current_url Another question is that is there a way to add some event handlers to Selenium for like URL-change? Phantomjs has the capacity but I'm not sure for Selenium. 4 Answers 4 You can get redirects from performance logs. According to docs and github answer here is what I've done in C#, should be possible to port in Python: performance var options = new ChromeOptions(); var cap = DesiredCapabilities.Chrome(); var perfL...