gpt4 book ai didi

selenium-webdriver - 如何在 Robot 框架中获取当前 URL?

转载 作者:行者123 更新时间:2023-12-04 07:56:03 25 4
gpt4 key购买 nike

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

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]

在此行之后,它会打开一个新窗口。如何获取新打开页面的 url 并执行输入文本等操作?
Set Browser Implicit Wait   20  

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

最佳答案

尝试这个:

${url}=   Get Location

关于selenium-webdriver - 如何在 Robot 框架中获取当前 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31833624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com