How to get the current URL in Robot framework?

前端 未结 3 1143
我在风中等你
我在风中等你 2021-01-20 02:04

When the \'apply\' link is clicked, it opens a new browser in Robot framework. How to get current url of that page? Here is the code:

Open Server     
Set Br         


        
相关标签:
3条回答
  • 2021-01-20 02:37

    Have you tried using the Select Window keyword?

    http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html#Select%20Window

    Click Link  popup_link  # opens new window  
    Select Window   popupName       
    Title Should Be Popup Title     
    Select Window           # Chooses the main window again
    

    It seems like you wish to verify the url of the new window which should be easily possible with the following:

    Select Window | url=https://google.com
    

    Obviously you need to replace the above url with what you're expecting. Let us know how you get on.

    0 讨论(0)
  • 2021-01-20 02:45

    getting the current URL is easy using the Execute Javascript SeleniumLibrary keyword:

    ${url} =  Execute Javascript  return window.location.href;
    
    0 讨论(0)
  • 2021-01-20 03:02

    Try this:

    ${url}=   Get Location
    
    0 讨论(0)
提交回复
热议问题