How could I do something like this:
<script type="text/javascript"> $(document).ready(function () {     if(window.location.contains("franky")) // This doesn't work, any suggestions?     {          alert("your url contains the name franky");     } }); </script> 
                Use the StartWith() method in C# to check for URL in a String.
get(url) send = driver. find_element_by_id("NextButton") send. click() if (driver. find_elements_by_css_selector("a[class='Error']")): print("Error class found") except ValueError: print("Something went wrong checking the URL.
You need add href property and check indexOf instead of contains
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>  <script type="text/javascript">    $(document).ready(function() {      if (window.location.href.indexOf("franky") > -1) {        alert("your url contains the name franky");      }    });  </script>  if (window.location.href.indexOf("franky") != -1)   would do it. Alternatively, you could use a regexp:
if (/franky/.test(window.location.href)) 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With