What is the best way to check URL change with Selenium in Python?

前端 未结 5 2029
我在风中等你
我在风中等你 2020-12-10 15:42

So, what\'s I want to do is to run a function on a specific webpage (which is a match with my regex).

Right now I\'m checking it every second and it works, but I\'m

5条回答
  •  盖世英雄少女心
    2020-12-10 16:10

    To really know that the URL has changed, you need to know the old one. Using WebDriverWait the implementation in Java would be something like:

    wait = new WebDriverWait(driver, 10);
    wait.until(ExpectedConditions.not(ExpectedConditions.urlToBe(oldUrl)));
    

    I know the question is for Python, but it's probably easy to translate.

提交回复
热议问题