5

I have look over the internet and didn't find an answer I am trying to store the URL in a variable. Found couple of answer that didn't work

  1. ${!url} should bring read-only URL of the site
  2. "StoreLocation" should store the URL and that doesn't exist in the IDE
  3. storeEval should store the URL and that doesn't exist in the IDE
Asaf Shazar
  • 1,065
  • 1
  • 11
  • 33

2 Answers2

8

For reference, this is what this looks like in the Selenium IDE

enter image description here enter image description here

You can then assert that the result is a given value like so:

enter image description here

There's some more useful info here too - https://www.selenium.dev/selenium-ide/

Tom
  • 1,956
  • 2
  • 18
  • 23
  • If the page redirected to a PDF file, it will not let you execute scripts. Which makes sense, but leaves no options for asserting URL's in this case. – xyz Aug 24 '23 at 08:27
3

You should use execute-script command like this:

execute script | return window.location.href; | url

So after execution of this command url variable will store url of page.

  • This just returns the browser extension url. You have to use "open" first (without any arguments it looks like it opens the website url). – user169771 Jun 03 '21 at 15:58