如何在Robot框架中获取当前URL? [英] How to get the current URL in Robot framework?

查看:866
本文介绍了如何在Robot框架中获取当前URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

单击应用"链接后,它将在Robot框架中打开一个新的浏览器.如何获取该页面的当前网址?这是代码:

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 Browser Implicit Wait   60  
Go To   ${server}/jobs  

Element Should Be Visible   xpath=.//*[@id='txtjobsearch']  

Input Text  xpath=.//*[@id='txtjobsearch']  ${job Title search}

Element Should Contain  xpath=(.//*[@class='clearfix tit-job']/div)[1]  ${Job title}

Element Should Be Visible   xpath=(.//*[@class='btn btn-sm btn-primary btnApply'])[1]   

Click Element   xpath=(.//*[@class='btn btn-sm btn-primary btnApply'])[1]

在此行之后,它将打开一个新窗口.如何获取新打开页面的网址并执行输入文字之类的操作?

After this line, it opens a new window. How to get url of newly opened page and do actions like input text?

Set Browser Implicit Wait   20  

Wait Until Page Contains Element    xpath=.//*[@class='text-primary']   

推荐答案

尝试一下:

${url}=   Get Location

这篇关于如何在Robot框架中获取当前URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆